結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー phspls
提出日時 2024-02-23 21:54:38
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 13,042 ms
コンパイル使用メモリ 398,776 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-29 06:24:56
合計ジャッジ時間 17,508 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut t = String::new();
    std::io::stdin().read_line(&mut t).ok();
    let t: usize = t.trim().parse().unwrap();
    for _ in 0..t {
        let mut nm = String::new();
        std::io::stdin().read_line(&mut nm).ok();
        let nm: Vec<&str> = nm.trim().split_whitespace().collect();
        let n = nm[0].chars().map(|c| c as usize - '0' as usize).collect::<Vec<_>>();
        let m = nm[1].parse::<usize>().unwrap();
        let mut summary = n[0];
        for i in 1..n.len() {
            summary *= 10;
            summary += n[i];
            summary %= m;
        }
        println!("{}", summary * (summary + 1) / 2 % m);
    }
}
0