結果

問題 No.1273 はじめのζ関数
ユーザー 沙耶花沙耶花
提出日時 2020-10-30 21:41:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 1,943 ms
コンパイル使用メモリ 196,084 KB
最終ジャッジ日時 2025-01-15 16:58:23
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000005


int main(){
	
	vector<long double> num(150,0.0);
	
	rep(i,150){
		if(i<=1)continue;
		
		for(int j=1;j<=100000;j++){
			num[i] += 1.0 / pow(j,i);
		}
		num[i] -= 1.0;
	}
	
	int x;
	cin>>x;
	
	if(x==2){
		cout<<1000000<<endl;
		return 0;
	}
	
	long double ans = 0.0;
	
	for(int i=x;i<150;i++){
		ans += num[i];
	}
	
	ans *= 1000000.0;
	
	cout<<floor(ans)<<endl;
	
    return 0;
}
0