結果
| 問題 |
No.442 和と積
|
| コンテスト | |
| ユーザー |
ouoz1V
|
| 提出日時 | 2016-11-11 23:23:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 478 bytes |
| コンパイル時間 | 1,249 ms |
| コンパイル使用メモリ | 157,600 KB |
| 実行使用メモリ | 16,840 KB |
| 最終ジャッジ日時 | 2024-11-25 09:30:23 |
| 合計ジャッジ時間 | 24,054 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 1 TLE * 10 |
ソースコード
#include<iostream>
#include<map>
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int a,long long int b){
while(a!=b){
if(a>b) a-=b;
else b-=a;
}
return a;
}
int main(){
long long int a,b;
long long int x;
cin>>a>>b;
int aplsb,amltb;
if(a==1||b==1){
cout<<1<<endl;
return 0;
}
x=gcd(a,b);
aplsb=(a+b)/x;
amltb=(a*b)/x;
cout<<x*gcd(aplsb,amltb)<<endl;
return 0;
}
ouoz1V