結果
| 問題 |
No.442 和と積
|
| コンテスト | |
| ユーザー |
HO_RI1991
|
| 提出日時 | 2016-11-11 23:21:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 813 bytes |
| コンパイル時間 | 815 ms |
| コンパイル使用メモリ | 100,468 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-04 22:34:24 |
| 合計ジャッジ時間 | 1,510 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<stack>
#include<set>
using namespace std;
const double pi=4*atan(1.0);
constexpr long long mod=static_cast<long long>(1e9+7);
using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;
long long gcd(long long a,long long b){
if(a < b)swap(a,b);
if(b < 1) return -1;
if(a % b == 0) return b;
return gcd(b,a % b);
}
int main(){
long long A,B;
cin>>A>>B;
long long C=A+B;
long long gcd_a=gcd(A,C);
C/=gcd_a;
long long gcd_b=gcd(B,C);
cout<<gcd_a*gcd_b<<endl;
//system("pause");
return 0;
}
HO_RI1991