結果

問題 No.1047 Zero (Novice)
ユーザー Baplisca
提出日時 2020-06-04 16:23:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 350 bytes
コンパイル時間 2,510 ms
コンパイル使用メモリ 191,156 KB
最終ジャッジ日時 2025-01-10 21:14:06
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  ll a,b; cin >> a >> b;
  ll res = b;
  ll cnt = 1;
  while(1){
      if(res == 0){
          cout << cnt << endl;
          return 0;
      }
      res = a*res + b;
      cnt++;
      if(cnt >= 1e5){
          cout << -1 << endl;
          return 0;
      }
  }
}
0