結果
| 問題 |
No.864 四方演算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-10 07:03:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 1,000 ms |
| コード長 | 560 bytes |
| コンパイル時間 | 2,160 ms |
| コンパイル使用メモリ | 193,448 KB |
| 最終ジャッジ日時 | 2025-02-08 01:09:57 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
ll N,K; cin >> N >> K;
ll ans = 0;
auto f = [N](ll x) {
return max(0LL, min(N, x - 1) - max(1LL, x - N) + 1);
};
for(ll L = 1; L * L <= K; L++) {
if(K % L == 0) {
if(L * L == K) {
ans += f(L) * f(L);
} else {
ans += 2LL * f(L) * f(K / L);
}
}
}
cout << ans << endl;
}