結果
| 問題 |
No.1047 Zero (Novice)
|
| コンテスト | |
| ユーザー |
vtr_coder
|
| 提出日時 | 2020-05-08 21:34:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 862 bytes |
| コンパイル時間 | 1,506 ms |
| コンパイル使用メモリ | 166,072 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-04 00:05:54 |
| 合計ジャッジ時間 | 2,117 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
# define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
# define DBG(fmt, ...)
#endif
const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010
signed main() {
cin.tie(0); cout.tie(0);
ios::sync_with_stdio(false);
int A, B;
cin >> A >> B;
int n = 0;
REP(i, 100000) {
n = A * n + B;
if(n == 0) {
printf("%lld\n", i + 1);
return 0;
}
}
printf("-1\n");
return 0;
}
vtr_coder