結果
問題 | No.864 四方演算 |
ユーザー |
![]() |
提出日時 | 2019-08-16 21:38:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 1,000 ms |
コード長 | 374 bytes |
コンパイル時間 | 984 ms |
コンパイル使用メモリ | 64,876 KB |
最終ジャッジ日時 | 2025-01-07 12:12:40 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; ll n,k; ll solve(ll x){ if(x>2*n) return 0; if(x<=1) return 0; if(x<=n + 1) return x - 1; return 2*n - x + 1; } int main(){ cin >> n >> k; ll ans = 0; for(ll i=1;i*i<=k;i++){ if(k%i==0){ ans += solve(i)*solve(k/i); if(i*i!=k){ ans += solve(k/i)*solve(i); } } } cout << ans << endl; }