結果

問題 No.40 多項式の割り算
ユーザー cra77756176
提出日時 2022-12-24 21:30:10
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 527 bytes
コンパイル時間 13,737 ms
コンパイル使用メモリ 402,180 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 05:37:09
合計ジャッジ時間 14,857 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut xx = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
    let mut xx: Vec<i64> = xx.split_whitespace().skip(1).flat_map(str::parse).collect();

    for i in (0..xx.len().saturating_sub(3)).rev() {
        xx[i + 1] += std::mem::replace(&mut xx[i + 3], 0);
    }

    let i = xx.iter().rposition(|&n| n != 0).unwrap_or(0);
    let output: Vec<String> = xx[..=i].iter().map(|&n| n.to_string()).collect();

    println!("{i}");
    println!("{}", output.join(" "));
}
0