Sort by

recency

|

1011 Discussions

|

  • + 0 comments

    long strangeCounter(long t) { long b = 1, tmp = 3, idx = 3, j; while (idx < t){ b += tmp; tmp *= 2; idx += tmp; } j = t - b + 1; return tmp - j + 1; } delray dermatology

  • + 0 comments

    long strangeCounter(long t) { long b = 1, tmp = 3, idx = 3, j; while (idx < t){ b += tmp; tmp *= 2; idx += tmp; } j = t - b + 1; return tmp - j + 1; }

  • + 0 comments
    long strangeCounter(long t) {
        long sum = 3;
        while(sum < t) {
            sum += sum + 3;
        }
        long diff = (sum + 1 - t);
        return diff;   
    }
    
  • + 0 comments

    include

    using namespace std;

    long strangeCounter(long t) { long cycle_start = 1; long cycle_length = 3;

    while (cycle_start + cycle_length <= t) {
        cycle_start += cycle_length;
        cycle_length *= 2;
    }
    
    return cycle_length - (t - cycle_start);
    

    }

    int main() { ios::sync_with_stdio(false); cin.tie(NULL);

    long t; cin >> t;
    cout << strangeCounter(t) << "\n";
    
    return 0;
    

    }

  • + 0 comments

    include

    using namespace std;

    long strangeCounter(long t) { long cycle_start = 1; long cycle_length = 3;

    while (cycle_start + cycle_length <= t) {
        cycle_start += cycle_length;
        cycle_length *= 2;
    }
    
    return cycle_length - (t - cycle_start);
    

    }

    int main() { ios::sync_with_stdio(false); cin.tie(NULL);

    long t; cin >> t;
    cout << strangeCounter(t) << "\n";
    
    return 0;
    

    }