結果

問題 No.634 硬貨の枚数1
ユーザー ixTL255ixTL255
提出日時 2023-01-02 22:25:40
言語 Rust
(1.77.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 529 bytes
コンパイル時間 13,498 ms
コンパイル使用メモリ 388,348 KB
実行使用メモリ 227,456 KB
最終ジャッジ日時 2024-05-05 06:42:09
合計ジャッジ時間 40,844 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 0 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 87 ms
28,800 KB
testcase_15 TLE -
testcase_16 AC 435 ms
67,456 KB
testcase_17 AC 792 ms
111,360 KB
testcase_18 AC 446 ms
67,200 KB
testcase_19 AC 1,872 ms
208,640 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 366 ms
64,384 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 0 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 37 ms
15,764 KB
testcase_35 AC 297 ms
59,904 KB
testcase_36 AC 947 ms
120,832 KB
testcase_37 AC 748 ms
106,752 KB
testcase_38 AC 81 ms
28,288 KB
testcase_39 AC 1,933 ms
212,736 KB
testcase_40 AC 887 ms
118,528 KB
testcase_41 AC 841 ms
114,944 KB
testcase_42 AC 1,926 ms
209,408 KB
testcase_43 AC 359 ms
63,488 KB
testcase_44 AC 1 ms
5,376 KB
testcase_45 AC 6 ms
5,376 KB
testcase_46 AC 81 ms
28,160 KB
testcase_47 TLE -
testcase_48 AC 1 ms
5,376 KB
testcase_49 AC 79 ms
28,160 KB
testcase_50 TLE -
testcase_51 AC 83 ms
28,160 KB
testcase_52 AC 1 ms
5,376 KB
testcase_53 AC 1 ms
5,376 KB
testcase_54 AC 1 ms
5,376 KB
testcase_55 TLE -
testcase_56 TLE -
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
testcase_60 TLE -
testcase_61 TLE -
testcase_62 TLE -
testcase_63 TLE -
testcase_64 TLE -
testcase_65 TLE -
testcase_66 TLE -
testcase_67 TLE -
testcase_68 TLE -
testcase_69 TLE -
testcase_70 TLE -
testcase_71 TLE -
testcase_72 TLE -
testcase_73 TLE -
testcase_74 TLE -
testcase_75 TLE -
testcase_76 AC 2 ms
5,376 KB
testcase_77 AC 184 ms
54,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::collections::HashSet;

fn main() {
	let mut n = String::new();
	std::io::stdin().read_line(&mut n).ok();
	let n: usize = n.trim().parse().unwrap();

	let mut t: Vec<usize> = vec![1];
	
	for i in 2.. {
		if i < n { t.push(t[i - 2] + i); }
		else { break; }
	}

	let set: HashSet<usize> = t.iter().cloned().collect();

	let mut ans = 3;
	if set.contains(&n) {
		println!("{}", 1);
		return;
	}

	for i in 0..set.len() {
		if set.contains(&(n - t[i])) {
			ans = 2;
		}
		if i > n / 2 { break; }
	}

	println!("{}", ans);
}
0