結果
問題 |
No.186 中華風 (Easy)
|
ユーザー |
![]() |
提出日時 | 2016-04-11 18:41:26 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 980 bytes |
コンパイル時間 | 630 ms |
コンパイル使用メモリ | 83,768 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-04 06:32:14 |
合計ジャッジ時間 | 1,827 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 WA * 2 |
ソースコード
/* -*- coding: utf-8 -*- * * 186.cc: No.186 中華風 (Easy) - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ ll xs[3], ys[3]; /* main */ int main() { for (int i = 0; i < 3; i++) cin >> xs[i] >> ys[i]; ll y01 = ys[0] * ys[1] / __gcd((int)ys[0], (int)ys[1]); for (ll k = 0; k <= ys[1]; k++) { ll z0 = xs[0] + k * ys[0]; if (z0 % ys[1] == xs[1]) { for (ll l = 0; l <= ys[2]; l++) { //printf("k=%lld,l=%lld\n", k, l); ll z1 = z0 + y01 * l; if (z1 % ys[2] == xs[2]) { printf("%lld\n", z1); return 0; } } } } puts("-1"); return 0; }