結果
| 問題 | No.889 素数! |
| コンテスト | |
| ユーザー |
akakimidori
|
| 提出日時 | 2019-09-20 21:40:56 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 916 bytes |
| 記録 | |
| コンパイル時間 | 8,119 ms |
| コンパイル使用メモリ | 181,216 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-04 13:51:42 |
| 合計ジャッジ時間 | 7,895 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
fn run() {
let mut s = String::new();
std::io::stdin().read_line(&mut s).unwrap();
let n: u32 = s.trim().parse().unwrap();
if n <= 1 {
println!("{}", n);
return;
}
let mut prime = true;
let mut k = 2;
while k * k <= n {
if n % k == 0 {
prime = false;
}
k += 1;
}
if prime {
println!("Sosu!");
return;
}
if (k - 1) * (k - 1) == n {
println!("Heihosu!");
return;
}
let mut k = 2;
while k * k * k < n {
k += 1;
}
if k * k * k == n {
println!("Ripposu!");
return;
}
let mut sum = 0;
let mut k = 1;
while k * k < n {
if n % k == 0 {
sum += k + n / k;
}
k += 1;
}
if sum == 2 * n {
println!("Kanzensu!");
return;
}
println!("{}", n);
}
fn main() {
run();
}
akakimidori