結果

問題 No.796 well known
ユーザー ut0sut0s
提出日時 2019-10-14 00:05:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 752 bytes
コンパイル時間 1,557 ms
コンパイル使用メモリ 166,080 KB
実行使用メモリ 8,488 KB
最終ジャッジ日時 2023-08-22 19:03:17
合計ジャッジ時間 5,802 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,488 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
  @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;
#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<int> 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;
}
0