結果
問題 | No.2417 Div Count |
ユーザー | kisa |
提出日時 | 2023-08-12 14:22:44 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 835 bytes |
コンパイル時間 | 1,807 ms |
コンパイル使用メモリ | 173,128 KB |
実行使用メモリ | 417,408 KB |
最終ジャッジ日時 | 2024-04-30 05:52:34 |
合計ジャッジ時間 | 5,288 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
10,624 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
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 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 3 ms
5,376 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | TLE | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; // 素因数分解 template <typename T> map<T, T> prime_factor(T n) { map<T, T> ret; for (T i = 2; i * i <= n; i++) { T tmp = 0; while (n % i == 0) { tmp++; n /= i; } ret[i] = tmp; } if (n != 1) ret[n] = 1; return ret; } /* divisor_num(n) 入力:整数 n 出力:nの約数の個数 計算量:O(√n) */ template <typename T> T divisor_num(T N) { map<T, T> pf = prime_factor(N); T ret = 1; for (auto p : pf) { ret *= (p.second + 1); } return ret; } int main() { int n, k; cin >> n >> k; int N=n-k; int num=divisor_num(N); if(k==0) { cout << num << endl; } else { cout << num-1 << endl; } }