結果

問題 No.864 四方演算
ユーザー chocopuuchocopuu
提出日時 2019-08-16 21:49:31
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 10 ms / 1,000 ms
コード長 755 bytes
コンパイル時間 1,133 ms
使用メモリ 3,528 KB
最終ジャッジ日時 2022-11-24 11:28:14
合計ジャッジ時間 2,453 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,436 KB
testcase_01 AC 10 ms
3,440 KB
testcase_02 AC 8 ms
3,372 KB
testcase_03 AC 8 ms
3,428 KB
testcase_04 AC 9 ms
3,444 KB
testcase_05 AC 7 ms
3,376 KB
testcase_06 AC 9 ms
3,444 KB
testcase_07 AC 9 ms
3,472 KB
testcase_08 AC 7 ms
3,492 KB
testcase_09 AC 5 ms
3,380 KB
testcase_10 AC 4 ms
3,436 KB
testcase_11 AC 2 ms
3,420 KB
testcase_12 AC 8 ms
3,380 KB
testcase_13 AC 5 ms
3,528 KB
testcase_14 AC 3 ms
3,420 KB
testcase_15 AC 10 ms
3,424 KB
testcase_16 AC 8 ms
3,424 KB
testcase_17 AC 9 ms
3,528 KB
testcase_18 AC 8 ms
3,368 KB
testcase_19 AC 7 ms
3,448 KB
testcase_20 AC 9 ms
3,476 KB
testcase_21 AC 8 ms
3,436 KB
testcase_22 AC 7 ms
3,492 KB
testcase_23 AC 2 ms
3,440 KB
testcase_24 AC 6 ms
3,496 KB
testcase_25 AC 4 ms
3,524 KB
testcase_26 AC 7 ms
3,372 KB
testcase_27 AC 1 ms
3,440 KB
testcase_28 AC 1 ms
3,376 KB
testcase_29 AC 1 ms
3,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
const long long MOD = 1e9+7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}



signed main(){
	int N,K,ans = 0;
	cin>>N>>K;
	for(int i = 2;i*i <= K;i++){
		if(K%i)continue;
		int a = i,b = K / i;
		int x = max(0ll,(a-1)-max(0ll,(a-1-N)*2));
		int y = max(0ll,(b-1)-max(0ll,(b-1-N)*2));
		ans += x*y;
		if(a!=b)ans += x*y;
	}
	cout<<ans<<endl;
}
0