結果
| 問題 |
No.1047 Zero (Novice)
|
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2022-11-01 21:04:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,291 ms / 2,000 ms |
| コード長 | 320 bytes |
| コンパイル時間 | 1,611 ms |
| コンパイル使用メモリ | 193,164 KB |
| 最終ジャッジ日時 | 2025-02-08 16:47:00 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int A,B;
cin>>A>>B;
if(A > 0 && B != 0){
cout<<-1<<endl;
return 0;
}
int N = 0;
for(int i=1;i<=1e9;i++){
N = A*N+B;
if(!N){
cout<<i<<endl;
return 0;
}
}
cout<<-1<<endl;
}
keisuke6