結果
問題 | No.864 四方演算 |
ユーザー |
![]() |
提出日時 | 2022-11-10 10:20:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 1,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 1,591 ms |
コンパイル使用メモリ | 165,880 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 13:13:27 |
合計ジャッジ時間 | 2,628 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>using namespace std;long max(long a,long b){if(a<b){return b;}return a;}long min(long a,long b){if(a>b){return b;}return a;}long count(long N,long x){return max(0,min(N,x-1)-max(x-N,1)+1);}int main(){long N,K;scanf("%ld %ld",&N,&K);long c = 0;for(long i=1;i*i<=K;i++){if(K%i != 0) continue;if(K/i != i){c += 2*count(N,K/i)*count(N,i);} else {c += count(N,K/i)*count(N,i);}}printf("%ld",c);}