結果
| 問題 | No.186 中華風 (Easy) |
| コンテスト | |
| ユーザー |
d2verb
|
| 提出日時 | 2015-05-06 16:50:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 924 bytes |
| 記録 | |
| コンパイル時間 | 728 ms |
| コンパイル使用メモリ | 82,380 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 19:17:37 |
| 合計ジャッジ時間 | 1,624 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 21 |
コンパイルメッセージ
main.cpp: In function ‘ll solve()’:
main.cpp:42:7: warning: ‘lcm’ may be used uninitialized in this function [-Wmaybe-uninitialized]
42 | Q += lcm;
| ~~^~~~~~
ソースコード
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>
using namespace std;
#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)
typedef long long ll;
typedef unsigned long long ull;
int X[3], Y[3];
ll solve(){
ll P = X[0], lcm;
for(int i = 0; i <= Y[0]; i++){
if(P % Y[1] == X[1]) { lcm = Y[0] * Y[1] / __gcd(Y[0], Y[1]); break; }
P += Y[0];
}
if(P == 0) return -1;
ll Q = P;
for(int i = 0; i <= Y[1]; i++){
if(Q % Y[2] == X[2]) return Q;
Q += lcm;
}
return -1;
}
int main(){
ios_base::sync_with_stdio(0);
for(int i = 0; i < 3; i++) cin >> X[i] >> Y[i];
cout << solve() << endl;
return 0;
}
d2verb