結果

問題 No.2947 Sing a Song
コンテスト
ユーザー YU Hirose
提出日時 2026-01-03 21:34:15
言語 Rust
(1.92.0 + proconio + num)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 621 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 27,503 ms
コンパイル使用メモリ 411,036 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-01-03 21:34:47
合計ジャッジ時間 29,033 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::{input, marker::Chars};
fn main() {
    input! {
        n: usize,
        s: Chars,
        t: Chars,
        a: [usize; n],
    }
    for x in &a {
        let mut res: Vec<String> = Vec::new();
        let mut cnt = x / s.len();
        while (x - cnt * s.len()) % t.len() != 0 {
            cnt -= 1;
        }
        for _ in 0..cnt {
            res.push(s.iter().collect());
        }
        let p = (x - cnt * s.len()) / t.len();
        for _ in 0..p {
            res.push(t.iter().collect());
        }
        for c in res {
            print!("{} ", c);
        }
        println!();
    }
}
0