結果

問題 No.1047 Zero (Novice)
ユーザー kyo1kyo1
提出日時 2020-05-20 10:08:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 333 bytes
コンパイル時間 2,534 ms
コンパイル使用メモリ 194,228 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-04-09 22:51:17
合計ジャッジ時間 5,538 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,884 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t A, B;
  cin >> A >> B;
  if (A * B > 0) {
    cout << -1 << '\n';
  } else {
    int64_t N = B;
    int res = 1;
    while (N != 0) {
      N = N * A + B;
      res++;
    }
    cout << res << '\n';
  }
  return 0;
}
0