結果

問題 No.634 硬貨の枚数1
ユーザー ixTL255ixTL255
提出日時 2023-01-02 22:22:24
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 503 bytes
コンパイル時間 14,689 ms
コンパイル使用メモリ 385,632 KB
実行使用メモリ 228,708 KB
最終ジャッジ日時 2024-05-05 06:40:36
合計ジャッジ時間 27,377 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 2 ms
6,812 KB
testcase_03 AC 1 ms
6,812 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 83 ms
28,820 KB
testcase_15 AC 1,598 ms
215,404 KB
testcase_16 AC 503 ms
67,776 KB
testcase_17 AC 758 ms
112,472 KB
testcase_18 AC 470 ms
67,392 KB
testcase_19 AC 1,353 ms
210,388 KB
testcase_20 AC 1,768 ms
221,124 KB
testcase_21 TLE -
testcase_22 AC 1,418 ms
214,740 KB
testcase_23 AC 374 ms
65,728 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 1 ms
6,944 KB
testcase_26 AC 1 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,944 KB
testcase_30 AC 1 ms
6,944 KB
testcase_31 AC 1 ms
6,944 KB
testcase_32 AC 1 ms
6,940 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 43 ms
15,756 KB
testcase_35 AC 307 ms
61,508 KB
testcase_36 AC 789 ms
121,792 KB
testcase_37 AC 559 ms
106,692 KB
testcase_38 AC 93 ms
28,356 KB
testcase_39 AC 1,563 ms
213,708 KB
testcase_40 AC 754 ms
120,528 KB
testcase_41 AC 670 ms
116,168 KB
testcase_42 AC 1,433 ms
210,000 KB
testcase_43 AC 357 ms
63,688 KB
testcase_44 AC 0 ms
6,948 KB
testcase_45 AC 7 ms
6,940 KB
testcase_46 AC 87 ms
28,224 KB
testcase_47 AC 1,669 ms
228,708 KB
testcase_48 AC 1 ms
6,944 KB
testcase_49 AC 84 ms
28,160 KB
testcase_50 AC 1,693 ms
227,904 KB
testcase_51 AC 83 ms
28,148 KB
testcase_52 AC 1 ms
6,944 KB
testcase_53 AC 1 ms
6,944 KB
testcase_54 AC 1 ms
6,944 KB
testcase_55 AC 1,469 ms
227,912 KB
testcase_56 AC 1,742 ms
227,148 KB
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
testcase_60 TLE -
testcase_61 TLE -
testcase_62 AC 1,993 ms
224,848 KB
testcase_63 TLE -
testcase_64 AC 1,999 ms
226,756 KB
testcase_65 TLE -
testcase_66 TLE -
testcase_67 AC 1,768 ms
226,904 KB
testcase_68 AC 1,778 ms
225,600 KB
testcase_69 AC 1,727 ms
225,868 KB
testcase_70 AC 1,706 ms
225,736 KB
testcase_71 AC 1,723 ms
225,604 KB
testcase_72 AC 1,648 ms
225,728 KB
testcase_73 AC 1,675 ms
224,204 KB
testcase_74 AC 1,707 ms
223,060 KB
testcase_75 AC 1,909 ms
223,688 KB
testcase_76 AC 2 ms
6,940 KB
testcase_77 AC 148 ms
54,728 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;
		}
	}

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