結果
| 問題 |
No.1988 Divisor Tiling
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-10 00:51:21 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 920 bytes |
| コンパイル時間 | 13,380 ms |
| コンパイル使用メモリ | 375,488 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-26 01:40:46 |
| 合計ジャッジ時間 | 18,158 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 22 |
ソースコード
fn main() {
let mut nh = String::new();
std::io::stdin().read_line(&mut nh).ok();
let nh: Vec<usize> = nh.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
let n = nh[0];
let h = nh[1];
let mut factors = vec![];
for i in 1..n {
if n % i == 0 {
factors.push(i);
}
}
if n / h <= 2 || h <= 2 {
if n / h == 1 || h == 1 {
println!("{}", factors.iter().flat_map(|&i| (0..i).map(|_| i.to_string()).collect::<Vec<String>>()).collect::<Vec<String>>().join(" "));
} else {
let val = factors.pop().unwrap();
println!("{}", (0..val).map(|_| val.to_string()).collect::<Vec<String>>().join(" "));
println!("{}", factors.iter().flat_map(|&i| (0..i).map(|_| i.to_string()).collect::<Vec<String>>()).collect::<Vec<String>>().join(" "));
}
} else {
println!("-1");
}
}