結果

問題 No.1273 はじめのζ関数
ユーザー rogi52
提出日時 2020-10-31 01:14:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 1,474 ms
コンパイル使用メモリ 166,296 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-22 04:12:04
合計ジャッジ時間 4,821 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    long double ans = 0.999;
    ll a; cin>>a;
    if(a == 2) ans = 1;
    for(ll i=2;i<a;i++){
        for(int j=2;j<=1000;j++){
            ans -= double(1.0 / double(pow(j,i)));
        }
    }
    ans *= 1000000;
    cout << ll(ans) << '\n';

    return 0;
}
0