結果
| 問題 |
No.2947 Sing a Song
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-26 13:18:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 617 bytes |
| コンパイル時間 | 2,020 ms |
| コンパイル使用メモリ | 193,820 KB |
| 最終ジャッジ日時 | 2025-02-25 00:17:55 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:2:31: warning: ‘e’ may be used uninitialized [-Wmaybe-uninitialized]
2 | #define rep(i,n) for(int i=0;i<(n);++i)
| ^
main.cpp:30:9: note: in expansion of macro ‘rep’
30 | rep(j,e) cout << s << " ";
| ^~~
main.cpp:21:13: note: ‘e’ was declared here
21 | int e,f;
| ^
main.cpp:2:31: warning: ‘f’ may be used uninitialized [-Wmaybe-uninitialized]
2 | #define rep(i,n) for(int i=0;i<(n);++i)
| ^
main.cpp:31:9: note: in expansion of macro ‘rep’
31 | rep(j,f) cout << t << " ";
| ^~~
main.cpp:21:15: note: ‘f’ was declared here
21 | int e,f;
| ^
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
string s,t;
cin >> s >> t;
int a = s.size();
int b = t.size();
rep(i,n){
int c;
cin >> c;
int e,f;
rep(j,c+1){
int d = c-b*j;
if(d%a==0){
e = d/a;
f = j;
break;
}
}
rep(j,e) cout << s << " ";
rep(j,f) cout << t << " ";
cout << endl;
}
}