結果

問題 No.186 中華風 (Easy)
ユーザー kotamanegikotamanegi
提出日時 2017-03-14 23:25:13
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,178 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 90,232 KB
実行使用メモリ 11,992 KB
最終ジャッジ日時 2023-09-12 12:24:15
合計ジャッジ時間 7,042 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

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 <= 100000000;++i) {
		long long hoge = x[0] + y[0] * i;
		if (hoge % y[1] == x[1]) {
			for (long long j = 0;j <= 100000000;++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