結果
問題 |
No.642 Two Operations No.1
|
ユーザー |
![]() |
提出日時 | 2018-05-08 14:41:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 232 bytes |
コンパイル時間 | 1,275 ms |
コンパイル使用メモリ | 156,868 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 02:27:08 |
合計ジャッジ時間 | 1,915 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%ld", &n); | ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { long n, x = 1, cnt = 0; scanf("%ld", &n); while (x < n) { x *= 2; cnt++; } while (x != n) { x--; cnt++; } printf("%ld\n", cnt); return 0; }