結果
| 問題 |
No.136 Yet Another GCD Problem
|
| コンテスト | |
| ユーザー |
taba
|
| 提出日時 | 2017-05-20 09:15:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 5,000 ms |
| コード長 | 518 bytes |
| コンパイル時間 | 1,232 ms |
| コンパイル使用メモリ | 130,164 KB |
| 最終ジャッジ日時 | 2025-01-05 00:29:13 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>
#include <regex>
#include <tuple>
#include <map>
#include <set>
#include <iostream>
#include <numeric>
using namespace std;
template<typename T>
constexpr T gcd(T a,T b){
return b?gcd(b,a%b):a;
}
int main(){
int n,k,mg=0;
-scanf("%d%d",&n,&k);
for(int i=1;i<n;i++){
mg=max(mg,gcd(i,n-i));
}
cout<<mg<<endl;
return 0;
}
taba