結果
問題 | No.253 ロウソクの長さ |
ユーザー |
|
提出日時 | 2015-07-25 00:19:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,258 bytes |
コンパイル時間 | 1,353 ms |
コンパイル使用メモリ | 159,000 KB |
実行使用メモリ | 40,368 KB |
最終ジャッジ日時 | 2024-07-16 20:50:16 |
合計ジャッジ時間 | 7,806 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 35 |
コンパイルメッセージ
main.cpp:18:4: warning: built-in function ‘pow10’ declared as non-function [-Wbuiltin-declaration-mismatch] 18 | ll pow10[10]; | ^~~~~ main.cpp: In function ‘ll rec(int, int)’: main.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type] 41 | } | ^
ソースコード
#include <bits/stdc++.h>#define rep(i, a) for (int i = 0; i < (a); i++)#define rep2(i, a, b) for (int i = (a); i < (b); i++)#define repr(i, a) for (int i = (a) - 1; i >= 0; i--)#define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--)#define itall(a) a.begin(), a.end()using namespace std;typedef long long ll;const ll inf = 1e9;const ll mod = 1e9 + 7;const double pi = acos(-1);const double eps = 1e-8;template<typename T> inline T sq(T a) { return a * a; }template<typename T> inline T cb(T a) { return a * a * a; }template<typename T> inline bool umin(T &a, const T &b) { return b < a && (a = b, true); }template<typename T> inline bool umax(T &a, const T &b) { return a < b && (a = b, true); }ll pow10[10];int get(int x) {cout << "? " << x << endl;int res;cin >> res;return res;}ll rec(int t, int ub) {repr2 (i, 1, ub) {ll g = get(pow10[i] - t);if (g == 0) return pow10[i] - t;if (g > 0) {return rec(t + pow10[i], i);}t++;}rep (i, 10) {if (get(0) == 0) return t;t++;}}int main() {pow10[0] = 1;rep2 (i, 1, 10) pow10[i] = 10 * pow10[i - 1];ll ans = rec(0, 10);cout << "! " << ans << endl;}