結果

問題 No.1273 はじめのζ関数
ユーザー tnakao0123tnakao0123
提出日時 2020-10-30 23:44:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 836 bytes
コンパイル時間 1,077 ms
コンパイル使用メモリ 90,228 KB
実行使用メモリ 12,628 KB
最終ジャッジ日時 2023-09-29 08:46:11
合計ジャッジ時間 7,958 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;

/* 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;
}

/* subroutines */

/* main */

int main() {
  int x;
  scanf("%d", &x);

  double sum = 0.0;
  for (int i = N; i >= x; i--)
    sum += zeta(i) - 1.0;

  printf("%d\n", (int)(sum * 1000000));
  return 0;
}
0