結果
問題 | No.136 Yet Another GCD Problem |
ユーザー | ty70 |
提出日時 | 2015-05-30 12:43:48 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,488 bytes |
コンパイル時間 | 885 ms |
コンパイル使用メモリ | 92,476 KB |
実行使用メモリ | 4,504 KB |
最終ジャッジ日時 | 2023-09-20 17:44:02 |
合計ジャッジ時間 | 2,454 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 1 ms
4,376 KB |
testcase_24 | WA | - |
testcase_25 | AC | 2 ms
4,380 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 2 ms
4,376 KB |
testcase_32 | WA | - |
testcase_33 | AC | 1 ms
4,380 KB |
testcase_34 | AC | 1 ms
4,376 KB |
testcase_35 | AC | 2 ms
4,376 KB |
testcase_36 | AC | 2 ms
4,380 KB |
testcase_37 | AC | 2 ms
4,380 KB |
testcase_38 | AC | 2 ms
4,376 KB |
testcase_39 | AC | 2 ms
4,380 KB |
testcase_40 | AC | 2 ms
4,380 KB |
testcase_41 | AC | 2 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cstdlib> // require abs exit atof atoi #include <cstdio> // require scanf printf #include <functional> #include <numeric> // require accumulate #include <cmath> // require fabs #include <climits> #include <limits> #include <cfloat> #include <iomanip> // require setw #include <sstream> // require stringstream #include <cstring> // require memset #include <cctype> // require tolower, toupper #include <fstream> // require freopen #include <ctime> // require srand #define rep(i,n) for(int i=0;i<(n);i++) #define ALL(A) A.begin(), A.end() using namespace std; typedef long long ll; typedef pair<int, int> P; vector<int> divisor (int a ){ vector<int> res; for (int i = 1; i*i <= a; i++ ){ if (a % i == 0 ){ res.push_back (i); if (i*i < a ) res.push_back (a/i); } // end if } // end for sort (ALL (res ) ); return res; } void disp_div (vector<int> d ){ rep (i, d.size() ) cerr << d[i] << (i != d.size() - 1 ? ' ' : '\n' ); } int main() { ios_base::sync_with_stdio(0); int N, K; cin >> N >> K; int res = 0; if (N <= K ){ res = 1; }else{ vector<int> div = divisor (N ); // disp_div (div ); vector<int>::iterator it = lower_bound (ALL (div ), K ); int k = *it; res = N/k; } // end if cout << res << endl; return 0; }