結果
| 問題 |
No.796 well known
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-14 00:08:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 784 bytes |
| コンパイル時間 | 1,729 ms |
| コンパイル使用メモリ | 169,916 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-17 19:57:21 |
| 合計ジャッジ時間 | 2,671 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
/**
@file 796.cpp
@title No.796 well known - yukicoder
@url https://yukicoder.me/problems/no/796
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)
template <class T>
void show(vector<T>& v) {
for (size_t i = 0; i < v.size(); i++) {
cout << v[i] << " ";
}
cout << "\n";
}
int main() {
int N;
cin >> N;
vector<uLL> num(N, 3);
uLL sum = 3 * N;
uLL pro = pow(3, N);
uLL 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;
}