Ad

made it shorter

Code
Diff
  • unsigned long long div2(unsigned long long a){
      unsigned long long ans{};
      while (ans + ans + 1 < a) ans++;
      return ans;
    }
    • unsigned long long div2(unsigned long long a){
    • unsigned long long ans = 0, i;
    • for (i = 1; i <= a; i++) {
    • if (i % 2){
    • continue;
    • } else {
    • ans++;
    • }
    • }
    • unsigned long long ans{};
    • while (ans + ans + 1 < a) ans++;
    • return ans;
    • }