結果
| 問題 | No.186 中華風 (Easy) |
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2015-04-19 23:58:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 815 bytes |
| 記録 | |
| コンパイル時間 | 664 ms |
| コンパイル使用メモリ | 80,052 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 19:00:14 |
| 合計ジャッジ時間 | 1,747 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 17 |
ソースコード
#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[10000001];
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]<=10000000LL;i++) candidate[y[0]*i+x[0]]++;
if(x[1]!=0) candidate[x[1]]++;
for(long i=1;y[1]*i+x[1]<=10000000LL;i++) candidate[y[1]*i+x[1]]++;
if(x[2]!=0) candidate[x[2]]++;
for(long i=1;y[2]*i+x[2]<=10000000LL;i++) candidate[y[2]*i+x[2]]++;
long long res=-1;
for(long i=1;i<=10000000LL;i++){
if(candidate[i]==3){res=i;break;}
}
cout<<res<<endl;
return 0;
}
Lay_ec