結果

問題 No.2177 Recurring ab
ユーザー MasKoaTSMasKoaTS
提出日時 2022-11-13 21:39:44
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 607 bytes
コンパイル時間 1,537 ms
コンパイル使用メモリ 28,536 KB
実行使用メモリ 5,896 KB
最終ジャッジ日時 2023-10-13 06:03:21
合計ジャッジ時間 5,645 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 愚直解

#include <stdio.h>
#define ll long long
#define max(a, b) (((a) < (b)) ? (b) : (a))

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable: 4996)


int main(void) {
	ll n;	scanf("%lld", &n);

	ll ans = 0;
	for (ll a = 0; a < 10; ++a) {
		for (ll b = 0; b < 10; ++b) {
			if (a == b) {
				continue;
			}
			ll min_p = max(a, b) + 1;
			if (min_p * min_p >= n * (min_p * a + b) + 1) {
				continue;
			}
			ll p;
			for (p = min_p; p * p < n * (p * a + b) + 1; ++p);
			ans += p - min_p;
		}
	}
	printf("%lld\n", ans);

	return 0;
}
0