結果
| 問題 |
No.1047 Zero (Novice)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-08 21:48:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 621 bytes |
| コンパイル時間 | 1,619 ms |
| コンパイル使用メモリ | 165,456 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 00:26:39 |
| 合計ジャッジ時間 | 3,304 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 6 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;
int main() {
ll A, B, now = 0;
cin >> A >> B;
if (B == 0)
cout << 1;
else if (A >= 1)
cout << -1;
else if (A == -1)
cout << 2;
else {
int ans = 0;
do {
now = A * now + B;
cout << now << endl;
++ans;
if (ans == 100000) {
ans = -1;
break;
}
} while (now != 0);
cout << ans;
}
cout << endl;
return 0;
}