結果
問題 | No.864 四方演算 |
ユーザー |
![]() |
提出日時 | 2021-05-29 14:25:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 1,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 1,630 ms |
コンパイル使用メモリ | 165,908 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 22:38:17 |
合計ジャッジ時間 | 2,616 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>typedef long long ll;using namespace std;int main() {ll N,K;cin>>N>>K;ll sum=0;for(ll n=2;n*n<=K;n++){if(K%n!=0)continue;ll p=K/n;ll an=0;ll ap=0;if(N<n && n<=2*N){an=2*N-n+1;}else if(n<=N){an=n-1;}if(N<p && p<=2*N){ap=2*N-p+1;}else if(p<=N){ap=p-1;}//cout<<n<<":"<<an<<" : "<<p<<" : "<<ap<<endl;if(n!=p){sum+=an*ap*2;}else{sum+=an*ap;}}cout<<sum<<endl;}