結果
問題 |
No.442 和と積
|
ユーザー |
![]() |
提出日時 | 2016-11-12 00:15:46 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 602 bytes |
コンパイル時間 | 350 ms |
コンパイル使用メモリ | 54,712 KB |
実行使用メモリ | 16,840 KB |
最終ジャッジ日時 | 2024-11-25 10:35:23 |
合計ジャッジ時間 | 25,081 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 TLE * 1 |
other | AC * 2 WA * 5 TLE * 11 |
ソースコード
#include<iostream> #include<cstdio> using namespace std; unsigned long long int gcd(unsigned long long int a,unsigned long long int b){ if(a==0||b==0) return 0; while(a!=b){ if(a>b) a-=b; else b-=a; } return a; } int main(){ unsigned long long int a,b; unsigned long long int x; cin>>a>>b; unsigned long long int aplsb,amltb; if(a==1||b==1){ cout<<1<<endl; return 0; } x=gcd(a,b); aplsb=(a+b)/x; amltb=(a/x)*(b/x); cout<<aplsb<<endl; cout<<amltb<<endl; cout<<x*gcd(aplsb,x*amltb)<<endl; return 0; }