結果
問題 |
No.40 多項式の割り算
|
ユーザー |
|
提出日時 | 2020-05-23 23:02:00 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 780 bytes |
コンパイル時間 | 14,179 ms |
コンパイル使用メモリ | 378,416 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 10:35:31 |
合計ジャッジ時間 | 15,182 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 WA * 2 RE * 1 |
ソースコード
fn main() { let mut d = String::new(); std::io::stdin().read_line(&mut d).ok(); let d: usize = d.trim().parse().unwrap(); let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let mut a: Vec<isize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); if d <= 2 { println!("{}", a.len() - 1); println!("{}", a.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(" ")); } while a.len() > 3 { let val: isize = a.pop().unwrap(); let pos = a.len()-2; a[pos] += val; } if a[2] == 0 { a.pop(); if a[1] == 0 { a.pop(); } } println!("{}", a.len() - 1); println!("{}", a.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(" ")); }