結果
問題 |
No.136 Yet Another GCD Problem
|
ユーザー |
![]() |
提出日時 | 2020-01-19 20:44:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 734 bytes |
コンパイル時間 | 1,549 ms |
コンパイル使用メモリ | 166,320 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 22:04:28 |
合計ジャッジ時間 | 2,964 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 25 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; class Prime { ll i, iLimit; public: bool isPrime(ll a); }; bool Prime::isPrime(ll a) { if (a == 1) return false; iLimit = (int)sqrt(a); for (i = 2; i <= iLimit; i++) if (a % i == 0) break; return (i == iLimit + 1 ? true : false); } //ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; Prime p; bool elf = p.isPrime(n); if (elf) { dunk(1); return 0; } for (int i = k; i <= n; ++i) { if (n % i == 0) { dunk(n / i); break; } } return 0; }