結果
問題 |
No.1047 Zero (Novice)
|
ユーザー |
![]() |
提出日時 | 2020-05-08 21:27:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 322 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 38,272 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-07-03 23:46:54 |
合計ジャッジ時間 | 3,875 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 TLE * 1 -- * 9 |
ソースコード
#include <stdio.h> #include <stdint.h> #include <cmath> int ri() { int n; scanf("%d", &n); return n; } int main() { int a = ri(); int b = ri(); int64_t cur = 0; int cnt = 0; for (; std::abs(cur) <= 4000000000; ) { cur = cur * a + b; cnt++; if (!cur) break; } printf("%d\n", cur ? -1 : cnt); return 0; }