結果

問題 No.40 多項式の割り算
ユーザー phspls
提出日時 2020-05-23 22:59:37
言語 Rust
(1.83.0 + proconio)
結果
RE  
実行時間 -
コード長 583 bytes
コンパイル時間 12,992 ms
コンパイル使用メモリ 404,032 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 10:30:23
合計ジャッジ時間 14,024 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut d = String::new();
    std::io::stdin().read_line(&mut d).ok();
    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();
    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(" "));
}
0