結果
| 問題 |
No.442 和と積
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-09 18:37:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 674 bytes |
| コンパイル時間 | 662 ms |
| コンパイル使用メモリ | 77,312 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-31 01:26:29 |
| 合計ジャッジ時間 | 1,589 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include <iostream>
#include <math.h>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;
ll GCD(ll x, ll y) {
if(y==0) return x;
else return GCD(y,x%y);
}
int main() {
ll A,B;
cin >> A >> B;
ll g = GCD(A,B);
g = g*GCD((A/g) + (B/g),g);
cout << g << endl;
}