結果

問題 No.186 中華風 (Easy)
ユーザー ttkkggww
提出日時 2022-08-25 04:23:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 4,334 ms
コンパイル使用メモリ 251,484 KB
最終ジャッジ日時 2025-01-31 03:55:22
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int n;
vector<ll> a;
vector<ll> b;

void solve(){
	auto p = crt(a,b);
	if(p.first==0&&p.second == 0){
		cout<<-1<<endl;
	}else{
		if(p.first)
		cout<<p.first<<endl;
		else cout<<lcm(lcm(b[0],b[1]),b[2])<<endl;
	}
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	n =3;
	a = vector<ll>(n);
	b = vector<ll>(n);
	for(int i = 0;i<n;i++)cin >> a[i] >> b[i];

	solve();
}
0