結果
問題 | No.2947 Sing a Song |
ユーザー |
|
提出日時 | 2025-01-12 15:15:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 517 bytes |
コンパイル時間 | 2,913 ms |
コンパイル使用メモリ | 192,112 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-12 15:15:44 |
合計ジャッジ時間 | 8,231 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll N,A; string S,T; cin>>N>>S>>T; ll SN=S.size(),TN=T.size(); for(int i=0;i<N;i++){ cin>>A; for(int s=A/SN;s>=0;s--){ if((A-s*SN)%TN==0){ for(int j=0;j<s;j++)cout<<S<<" "; for(int j=0;j<(A-s*SN)/TN;j++)cout<<T<<" "; cout<<"\n"; break; } } } }