結果

問題 No.864 四方演算
ユーザー ahe100ahe100
提出日時 2019-08-16 22:18:02
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 597 bytes
コンパイル時間 4,530 ms
コンパイル使用メモリ 166,308 KB
実行使用メモリ 7,808 KB
最終ジャッジ日時 2023-10-24 00:43:25
合計ジャッジ時間 4,127 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,792 KB
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;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)

/*
*/

ll n,k,ans=0;

ll f(ll x){
	if(x>=2*n+1)return 0;
	if(n>=x)return x-1;
	return max(2*n+1-x,0LL);
}

void init(){
	cin>>n>>k;
}

int main(void){
	init();
	for(int i=2; i*i<=k; i++){
		if(k%i==0){
			if(i*i==k){
				ans+=f(i)*f(i);
			}else{
				ans+=2*f(i)*f(k/i);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
0