結果

問題 No.796 well known
ユーザー kyo1
提出日時 2020-08-29 18:19:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 3,974 ms
コンパイル使用メモリ 193,912 KB
最終ジャッジ日時 2025-01-13 20:30:22
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> res;
  res.emplace_back(3);
  if ((N - 1) % 3 == 0) res.emplace_back(2);
  if ((N - 1) % 3 == 2) {
    res.emplace_back(2);
    res.emplace_back(2);
  }
  while ((int)res.size() < N) {
    res.emplace_back(1);
  }
  for (const auto& e : res) {
    cout << e << (&e == &res.back() ? '\n' : ' ');
  }
  return 0;
}
0