結果

問題 No.136 Yet Another GCD Problem
ユーザー latte0119latte0119
提出日時 2015-05-04 00:57:34
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 244 bytes
コンパイル時間 1,232 ms
コンパイル使用メモリ 157,276 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 18:38:24
合計ジャッジ時間 2,533 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int N,K;

int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int main(){
    cin>>N>>K;
    int ma=0;
    for(int i=1;i<N;i++){
        ma=max(ma,gcd(i,N));
    }
    cout<<ma<<endl;
    return 0;
}
0