結果

問題 No.2947 Sing a Song
ユーザー a01sa01to
提出日時 2024-12-29 00:16:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 3,180 ms
コンパイル使用メモリ 245,616 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-29 00:16:42
合計ジャッジ時間 7,197 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  rep(_, n) {
    int a;
    cin >> a;
    for (int cnt = a / s.size(); cnt >= 0; --cnt) {
      int rem = a - cnt * s.size();
      if (rem % t.size() == 0) {
        rep(__, cnt) cout << s << ' ';
        rep(__, rem / t.size()) cout << t << ' ';
        cout << endl;
        break;
      }
    }
  }
  return 0;
}
0