結果

問題 No.2947 Sing a Song
ユーザー Carpenters-Cat
提出日時 2024-10-25 22:40:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 196,604 KB
最終ジャッジ日時 2025-02-24 23:39:30
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
	int N;
	cin >> N;
	string s, t;
	cin >> s >> t;
	while (N--) {
		int a;
		cin >> a;
		std::vector<string> ans;
		while (a % s.size()) {
			a -= t.size();
			ans.push_back(t);
		}
		while (a) {
			a -= s.size();
			ans.push_back(s);
		}
		for (int i = 0; i < ans.size(); i ++) {
			cout << (i ? " " : "") << ans[i];
		}
		cout << endl;
	}
}
0