結果

問題 No.864 四方演算
ユーザー tomahoku001
提出日時 2019-10-11 01:40:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 165,808 KB
実行使用メモリ 13,952 KB
最終ジャッジ日時 2024-11-22 08:32:49
合計ジャッジ時間 54,873 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 1 TLE * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> P;

int main(){
    LL N, K;
    cin >> N >> K;
    LL ans = 0;
    for(int i = 1;i*i <= K;i++){
        if(K%i == 0){
            LL a = i;
            LL b = K/i;
            LL res = 1;
            if(a <= 2*N){
                if(a-1 <= N)    res *= a-1;
                else    res *= 2*N-a+1;
            } else  res = 0;
            if(b <= 2*N){
                if(b-1 <= N)    res *= b-1;
                else    res *= 2*N-b+1;
            } else   res = 0;
            ans += res;
        }
    }
    ans *= 2;
    cout << ans << endl;
}
0