結果

問題 No.2947 Sing a Song
ユーザー Hydrogen332
提出日時 2024-10-29 22:35:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 2,175 ms
コンパイル使用メモリ 193,152 KB
最終ジャッジ日時 2025-02-25 01:30:50
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    cin.tie(nullptr);
    
    int N;
    string S, T;
    cin >> N >> S >> T;
    
    int Ssiz = S.size();
    int Tsiz = T.size();
    
    rep(line, 0, N) {
        int A;
        cin >> A;
        
        int cnt = A / Ssiz;
        while ((A - cnt * Ssiz) % Tsiz != 0) cnt--;
        
        rep(i, 0, cnt) cout << S << ' ';
        rep(i, 0, (A - cnt * Ssiz) / Tsiz) cout << T << ' ';
        cout << '\n';
    }
}
0