結果
問題 | No.642 Two Operations No.1 |
ユーザー | ミドリムシ |
提出日時 | 2018-02-02 21:33:02 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 536 ms |
コンパイル使用メモリ | 68,624 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-30 02:03:12 |
合計ジャッジ時間 | 1,442 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 1 ms
4,376 KB |
testcase_14 | AC | 1 ms
4,380 KB |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(){ long N; cin >> N; long times_num = 1; long ans = 0; for(; times_num < N; times_num *= 2){ ans++; } for(int i = 1; i < 50; i++){ if(((times_num - N) >> i) & 1){ ans--; } } cout << ans + times_num - N << endl; }