結果
問題 | No.864 四方演算 |
ユーザー | nakaken88 |
提出日時 | 2019-08-16 21:45:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 641 bytes |
コンパイル時間 | 1,599 ms |
コンパイル使用メモリ | 166,896 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 10:44:59 |
合計ジャッジ時間 | 2,753 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define BR "\n" #define SP " " #define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR; #define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR; int main() { ll N, K; cin >> N >> K; ll ans = 0; for (ll i = 2; i <= sqrt(K); i++) { if (K % i != 0) continue; ll j = K / i; ll temp1 = max(i - 1 - N, 0LL) * 2; ll temp2 = max(j - 1 - N, 0LL) * 2; ll temp = max(i - 1 - temp1, 0LL) * max(j - 1 - temp2, 0LL); ans += temp; if (j != i) ans += temp; } cout << ans << "\n"; return 0; }