結果
| 問題 |
No.186 中華風 (Easy)
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2016-04-11 18:43:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 990 bytes |
| コンパイル時間 | 1,288 ms |
| コンパイル使用メモリ | 82,904 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 18:27:33 |
| 合計ジャッジ時間 | 1,401 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
/* -*- 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 > 0 && z1 % ys[2] == xs[2]) {
printf("%lld\n", z1);
return 0;
}
}
}
}
puts("-1");
return 0;
}
tnakao0123