結果
問題 | No.864 四方演算 |
ユーザー |
![]() |
提出日時 | 2021-09-26 15:56:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 66,432 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 15:38:32 |
合計ジャッジ時間 | 1,607 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include<iostream>#include<vector>using namespace std;using ll=long long;int main(){ll n,k;cin>>n>>k;ll ans=0;for(ll i=1;i*i<=k;i++){ll tmpa,tmpb;if(k%i==0){if(i<=n)tmpa=i-1;else tmpa=max(0ll,2*n-i+1);if(k/i<=n)tmpb=k/i-1;else tmpb=max(0ll,2*n-(k/i)+1);if(tmpa==tmpb&&i==k/i)ans+=tmpa*tmpb;else ans+=2ll*tmpa*tmpb;}}cout<<ans<<endl;}