結果
| 問題 |
No.442 和と積
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-25 22:56:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 501 bytes |
| コンパイル時間 | 1,135 ms |
| コンパイル使用メモリ | 79,856 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-04 22:54:07 |
| 合計ジャッジ時間 | 4,772 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 18 |
コンパイルメッセージ
main.cpp: In function ‘long long int g(long long int, long long int)’:
main.cpp:18:53: warning: control reaches end of non-void function [-Wreturn-type]
18 | long long g(long long x,long long y) { if (y) (g(y, x%y));else return x; }
| ~~^~~~~~~~~
ソースコード
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
//#include<bits/stdc++.h>
long long g(long long x,long long y) { if (y) (g(y, x%y));else return x; }
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
long long p = g(a, b);
cout << g(a/p + b/p, p)*p << endl;
return 0;
}