/** @file 796.cpp @title No.796 well known - yukicoder @url https://yukicoder.me/problems/no/796 **/ #include using namespace std; typedef long long LL; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, N) for (int i = 0; i < (N); ++i) template void show(vector& v) { for (size_t i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << "\n"; } int main() { int N; cin >> N; vector num(N, 3); int sum = 3 * N; int pro = pow(3, N); int limit = 312456; while (1) { if (sum % 3 == 1 && pro % 3 == 0 && sum <= limit) { show(num); break; } else { num[0]++; sum++; pro *= ((double)num[0] / (double)(num[0] - 1)); } } return 0; }