結果
問題 |
No.442 和と積
|
ユーザー |
|
提出日時 | 2021-03-25 18:49:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 636 bytes |
コンパイル時間 | 2,177 ms |
コンパイル使用メモリ | 165,004 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 04:02:36 |
合計ジャッジ時間 | 2,191 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; // 計算回数は 2 * 10^8 ぐらいまで using ll = long long; // int は 2 * 10^9 まで const int INF = 1e9; // 10^9 const ll LINF = 1e18; // 10^18 template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;}return 0;} template<class T>bool chmin(T &a, const T &b) {if (b<a) {a=b; return 1;}return 0;} ll gcd(ll a, ll b) { if (b == 0) { return a; } return gcd(b, a % b); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll A, B; cin >> A >> B; ll g = gcd(A+B, A); ll h = gcd(A+B, B); cout << lcm(g, h) << endl; }