結果
| 問題 | 
                            No.864 四方演算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-08-16 21:34:11 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 12 ms / 1,000 ms | 
| コード長 | 484 bytes | 
| コンパイル時間 | 1,636 ms | 
| コンパイル使用メモリ | 170,588 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-25 10:42:33 | 
| 合計ジャッジ時間 | 2,581 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    int64_t N, K;
    cin >> N >> K;
    vector<int64_t> div;
    for(int64_t i=1; i*i<=K; i++) if(K%i == 0){
        div.push_back(i);
        if(i < K/i) div.push_back(K/i);
    }
    int64_t ans = 0;
    for(int64_t d1 : div){
        int64_t res = 1;
        for(int64_t d : {d1, K/d1}){
            res *= max(int64_t(0), min(d-1, 2*N+1-d));
        }
        ans += res;
    }
    cout << ans << endl;
    return 0;
}