結果
問題 |
No.305 鍵(2)
|
ユーザー |
|
提出日時 | 2015-11-28 01:06:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,010 bytes |
コンパイル時間 | 584 ms |
コンパイル使用メモリ | 64,248 KB |
実行使用メモリ | 40,148 KB |
平均クエリ数 | 10.08 |
最終ジャッジ日時 | 2024-07-16 21:53:20 |
合計ジャッジ時間 | 4,862 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 TLE * 1 -- * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=] 19 | printf("%010d\n", answer); | ~~~~^ ~~~~~~ | | | | int ll {aka long long int} | %010lld
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <math.h> using namespace std; typedef unsigned int uint; typedef unsigned long ulong; typedef long long int ll; int main() { ll answer = 0; ll targetmask = 1; ll responce1 = 0; string responce2; ll lastnumber = -1; while (true) { printf("%010d\n", answer); cin >> responce1 >> responce2; if (responce2 == "unlocked") { return 0; } else { if (lastnumber == -1) lastnumber = responce1; if (responce1 < lastnumber) { answer -= targetmask; targetmask *= 10; lastnumber = responce1 + 1; } else if (responce1 > lastnumber) { targetmask *= 10; lastnumber = responce1; } else { lastnumber = responce1; answer += targetmask; } } } return 0; }