結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| ユーザー |
Ronlynes
|
| 提出日時 | 2017-01-28 23:26:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 288 bytes |
| コンパイル時間 | 501 ms |
| コンパイル使用メモリ | 58,196 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-23 21:31:38 |
| 合計ジャッジ時間 | 1,583 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 5 WA * 16 |
コンパイルメッセージ
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){
x /= 2;
remain = x % 2;
cnt++;
}
if(remain == 0){
ans = cnt;
}else{
ans = cnt + 1;
}
cout << ans << endl;
return 0;
}
Ronlynes