結果

問題 No.186 中華風 (Easy)
ユーザー kotamanegikotamanegi
提出日時 2017-03-14 23:23:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,180 bytes
コンパイル時間 730 ms
コンパイル使用メモリ 89,740 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 12:24:08
合計ジャッジ時間 3,175 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 209 ms
4,376 KB
testcase_01 AC 25 ms
4,376 KB
testcase_02 AC 59 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 55 ms
4,376 KB
testcase_05 AC 64 ms
4,376 KB
testcase_06 AC 139 ms
4,376 KB
testcase_07 AC 49 ms
4,376 KB
testcase_08 AC 64 ms
4,376 KB
testcase_09 AC 60 ms
4,380 KB
testcase_10 AC 352 ms
4,376 KB
testcase_11 AC 86 ms
4,380 KB
testcase_12 AC 16 ms
4,380 KB
testcase_13 AC 90 ms
4,376 KB
testcase_14 AC 17 ms
4,376 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 31 ms
4,376 KB
testcase_19 AC 22 ms
4,376 KB
testcase_20 AC 7 ms
4,376 KB
testcase_21 AC 11 ms
4,376 KB
testcase_22 AC 18 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <time.h>
#include <random>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define LONG_INF 10000000000000000
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
long long lcm(long long a, long long b) {
	return a*b / gcd(a, b);
}
int main() {
	long long x[3], y[3];
	REP(i, 3) {
		cin >> x[i] >> y[i];
	}
	for (long long i = 0;i <= y[1]+x[1];++i) {
		long long hoge = x[0] + y[0] * i;
		if (hoge % y[1] == x[1]) {
			for (long long j = 0;j <= y[2] + x[2];++j) {
				long long gyao = hoge + lcm(y[0], y[1]) * j;
				if (gyao % y[2] == x[2]) {
					cout << gyao << endl;
					return 0;
				}
			}
			cout << -1 << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}
0