結果

問題 No.864 四方演算
ユーザー tomahoku001tomahoku001
提出日時 2019-10-11 01:40:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 1,647 ms
コンパイル使用メモリ 165,812 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-05-02 00:02:22
合計ジャッジ時間 4,029 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

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