結果

問題 No.1273 はじめのζ関数
ユーザー tnakao0123tnakao0123
提出日時 2020-10-30 23:52:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,123 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 91,404 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-29 09:01:24
合計ジャッジ時間 2,290 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 WA -
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1273.cc:  No.1273 はじめのζ関数 - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 8000;

const int as[21] = {
  0,
  0, 999874, 355065, 153009, 70685,
  33758, 16414, 8065, 3988, 1979,
  985, 491, 245, 122, 61,
  30, 15, 7, 3, 1
};

/* typedef */

typedef long long ll;

/* global variables */

double zeta(int n) {
  double sum = 0.0;
  for (int i = N; i >= 1; i--) sum += pow(1.0 / i, n);
  return sum;
}

void calc() {
  for (int x = 2; x <= 30; x++) {
    double sum = 0.0;
    for (int i = N + x; i >= x; i--)
      sum += zeta(i) - 1.0;
    
    printf("%d %d\n", x, (int)(sum * 1000000));
  }
}

/* subroutines */

/* main */

int main() {
  //calc(); return 0;
  
  int x;
  scanf("%d", &x);

  printf("%d\n", (x <= 20) ? as[x] : 0);
  return 0;
}
0