結果
| 問題 |
No.1047 Zero (Novice)
|
| コンテスト | |
| ユーザー |
mizni
|
| 提出日時 | 2020-05-08 22:54:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 289 bytes |
| コンパイル時間 | 2,115 ms |
| コンパイル使用メモリ | 191,672 KB |
| 最終ジャッジ日時 | 2025-01-10 09:09:47 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 1 TLE * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, n = 0, ans = 0;
cin >> a >> b;
if ((a > 0 && b > 0) || (a == 0)) {
cout << "-1"
<< "\n";
return 0;
}
do {
n = a * n + b;
ans++;
} while (n != 0);
cout << ans << "\n";
}
mizni