結果
| 問題 | 
                            No.136 Yet Another GCD Problem
                             | 
                    
| コンテスト | |
| ユーザー | 
                             haraduka_
                         | 
                    
| 提出日時 | 2015-01-26 00:11:09 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 911 bytes | 
| コンパイル時間 | 938 ms | 
| コンパイル使用メモリ | 92,828 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-23 03:06:54 | 
| 合計ジャッジ時間 | 2,000 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 WA * 10 | 
ソースコード
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<functional>
#include<utility>
#include<iterator>
#include<algorithm>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<cstring>
#include<iomanip>
using namespace std;
#define len(val) static_cast<int>(val.size())
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
typedef pair<int, int> P;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> s;
    for(int i=1; i<n; i++){
        if(n%i == 0) s.push_back(i);
    }
    int res = 1;
    for(int i=len(s)-1; i>=0; i--){
        int tmp = n/s[i];
        if(tmp >= k || tmp <= 2){
            res = max(res, s[i]);
        }
    }
    cout << res << endl;
}
            
            
            
        
            
haraduka_