結果
問題 | No.1047 Zero (Novice) |
ユーザー |
![]() |
提出日時 | 2020-05-08 21:47:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 857 bytes |
コンパイル時間 | 1,422 ms |
コンパイル使用メモリ | 164,592 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 00:26:18 |
合計ジャッジ時間 | 1,965 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#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, 3) { n = A * n + B; if(n == 0) { printf("%lld\n", i + 1); return 0; } } printf("-1\n"); return 0; }