結果

問題 No.186 中華風 (Easy)
ユーザー kotamanegikotamanegi
提出日時 2017-03-14 23:27:44
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,197 bytes
コンパイル時間 1,169 ms
コンパイル使用メモリ 89,748 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-27 01:04:44
合計ジャッジ時間 9,192 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,678 ms
4,380 KB
testcase_01 AC 26 ms
4,376 KB
testcase_02 AC 60 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 55 ms
4,376 KB
testcase_05 AC 65 ms
4,376 KB
testcase_06 AC 140 ms
4,376 KB
testcase_07 AC 49 ms
4,376 KB
testcase_08 AC 64 ms
4,376 KB
testcase_09 AC 61 ms
4,376 KB
testcase_10 TLE -
testcase_11 AC 85 ms
4,376 KB
testcase_12 AC 16 ms
4,376 KB
testcase_13 AC 91 ms
4,376 KB
testcase_14 AC 18 ms
4,380 KB
testcase_15 AC 5 ms
4,380 KB
testcase_16 AC 88 ms
4,380 KB
testcase_17 AC 12 ms
4,376 KB
testcase_18 AC 31 ms
4,376 KB
testcase_19 AC 106 ms
4,380 KB
testcase_20 AC 106 ms
4,376 KB
testcase_21 AC 105 ms
4,380 KB
testcase_22 AC 105 ms
4,376 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 <= 10000000;++i) {
		long long hoge = x[0] + y[0] * i;
		if (hoge % y[1] == x[1]&&(i != 0||x[0] != 0)) {
			for (long long j = 0;j <= 10000000;++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