結果
問題 |
No.1047 Zero (Novice)
|
ユーザー |
![]() |
提出日時 | 2020-05-08 21:25:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 1,922 ms |
コンパイル使用メモリ | 191,816 KB |
最終ジャッジ日時 | 2025-01-10 08:00:08 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 1000000 int main(){ long long A,B; cin>>A>>B; if(B==0){ cout<<1<<endl; return 0; } if((A<0&&B>0)||(A>0&&B<0)){ long long N = 0; for(int i=1;i<100;i++){ N *= A; N += B; if(N==0){ cout<<i<<endl; return 0; } if(abs(N)>1000000000LL){ cout<<-1<<endl; return 0; } } return -1; } else{ cout<<-1<<endl; } return 0; }