結果

問題 No.186 中華風 (Easy)
ユーザー Lay_ecLay_ec
提出日時 2015-04-19 23:54:10
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 74,200 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-18 02:01:51
合計ジャッジ時間 1,606 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;

int candidate[1000001];

int main()
{
	//Z=aY+X
	long long x[3],y[3];
	for(int i=0;i<3;i++) cin>>x[i]>>y[i];

	if(x[0]!=0) candidate[x[0]]++;
	for(long i=1;y[0]*i+x[0]<=1000000LL;i++) candidate[y[0]*i+x[0]]++;
	if(x[1]!=0) candidate[x[1]]++;
	for(long i=1;y[1]*i+x[1]<=1000000LL;i++) candidate[y[1]*i+x[1]]++;
	if(x[2]!=0) candidate[x[2]]++;
	for(long i=1;y[2]*i+x[2]<=1000000LL;i++) candidate[y[2]*i+x[2]]++;

	long long res=-1;
	for(long i=1;i<=1000000LL;i++){
		if(candidate[i]==3){res=i;break;}
	}

	cout<<res<<endl;

	return 0;
}
0