結果
問題 |
No.2947 Sing a Song
|
ユーザー |
|
提出日時 | 2024-10-26 02:38:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 593 bytes |
コンパイル時間 | 7,907 ms |
コンパイル使用メモリ | 167,752 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-26 02:38:47 |
合計ジャッジ時間 | 7,980 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define REP(i,n) for(int i=0;i<int(n);i++) int a[200010]; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int i,j; int N; string S,T; cin >> N >> S >> T; for(i=1;i<=N;i++) cin >> a[i]; int s=S.size(),t=T.size(); for(i=1;i<=N;i++){ for(j=a[i]/s;j>=0;j--){ if((a[i]-s*j)%t==0){ REP(k,j) cout << S << ' '; REP(k,(a[i]-s*j)/t) cout << T << ' '; cout << endl; break; } } } return 0; }