結果
問題 |
No.1047 Zero (Novice)
|
ユーザー |
![]() |
提出日時 | 2020-05-08 21:30:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 346 bytes |
コンパイル時間 | 1,485 ms |
コンパイル使用メモリ | 165,672 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 23:54:31 |
合計ジャッジ時間 | 2,443 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); ll a, b, n = 0; cin >> a >> b; ll ans = 0; for (int i = 1; i <= 10000000; i++) { n = a * n + b; if (n == 0) { cout << i << '\n';; return 0; } } cout << "-1\n"; return 0; }