結果
問題 |
No.2947 Sing a Song
|
ユーザー |
![]() |
提出日時 | 2024-11-23 14:04:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 575 bytes |
コンパイル時間 | 1,520 ms |
コンパイル使用メモリ | 166,924 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-23 14:04:06 |
合計ジャッジ時間 | 5,037 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; string S, T; cin >> N >> S >> T; for (int i = 0; i < N; i++) { int A, tots = 0, tott = 0; cin >> A; while (tots < A) tots += S.size(); while (tots + tott != A) { tots -= S.size(); while (tots + tott < A) tott += T.size(); } for (int j = 0; j < tots / (int)S.size(); j++) { if (j != 0) cout << ' '; cout << S; } for (int j = 0; j < tott / (int)T.size(); j++) { if (j != 0 || tots != 0) cout << ' '; cout << T; } cout << endl; } }