結果
問題 | No.2417 Div Count |
ユーザー |
![]() |
提出日時 | 2024-11-15 17:09:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 471 bytes |
コンパイル時間 | 1,909 ms |
コンパイル使用メモリ | 195,500 KB |
最終ジャッジ日時 | 2025-02-25 04:16:35 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); long long n, k; cin >> n >> k; vector<long long> divs; for (long long i = 1; i * i <= n - k; i++) { if ((n - k) % i == 0) { divs.push_back(i); if (i * i != n - k) { divs.push_back((n - k) / i); } } } int ans = 0; for (long long a : divs) { if (n % a == k) { ans++; } } cout << ans << endl; }