結果
問題 | No.2947 Sing a Song |
ユーザー |
![]() |
提出日時 | 2024-10-25 21:25:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 636 bytes |
コンパイル時間 | 4,200 ms |
コンパイル使用メモリ | 251,672 KB |
最終ジャッジ日時 | 2025-02-24 22:46:01 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000000LL int main(){ int n; cin>>n; string s,t; cin>>s>>t; int x = s.size(),y = t.size(); rep(i,n){ long long a; cin>>a; for(int j=a;j>=0;j--){ long long tt = a-(long long)j*x; if(tt>=0 && tt%y==0){ long long num = j + tt/y; rep(k,num){ if(k!=0)cout<<' '; if(k<j)cout<<s; else cout<<t; } cout<<endl; break; } } } return 0; }