結果
問題 |
No.47 ポケットを叩くとビスケットが2倍
|
ユーザー |
![]() |
提出日時 | 2017-01-28 23:27:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 288 bytes |
コンパイル時間 | 796 ms |
コンパイル使用メモリ | 56,288 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 21:32:29 |
合計ジャッジ時間 | 1,710 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:14:9: warning: ‘remain’ may be used uninitialized in this function [-Wmaybe-uninitialized] 14 | if(remain == 0){ | ^~
ソースコード
#include <iostream> #include <algorithm> #include <string> using namespace std; int main() { long long x, cnt=0, ans, remain; cin >> x; while(x >= 2){ remain = x % 2; x /= 2; cnt++; } if(remain == 0){ ans = cnt; }else{ ans = cnt + 1; } cout << ans << endl; return 0; }