結果

問題 No.1273 はじめのζ関数
ユーザー AbhinavAbhinav
提出日時 2020-10-31 00:00:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,293 bytes
コンパイル時間 1,778 ms
コンパイル使用メモリ 166,288 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 03:43:08
合計ジャッジ時間 3,611 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 39 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

  #include <bits/stdc++.h>
  #define ll long long
  #define ull unsigned long long
  #define mod 1e9
  #define vll vector<ll>
  #define pb push_back
  #define what_is(x) cerr << #x << " is " << x << endl;
  using namespace std;
  inline void sol() {}
  double exp(double a, long b){
    double ans = 1;
    while(b != 0){
      if(b%2)
        ans = ans*a;
      a = a*a;
      b = b / 2;
    }
    return ans;
  }
  int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    double x;
    cin>>x;
    if(x >= 20){
      cout<<0<<endl;
      return 0;
    }
    double end = 1e7;
    if(x == 2){
      // double  ans = 0;
      // for(int i=2;i<1e6;i++)
      //   ans += (1.0/(i*(i-1.0)))*1e6;
      // cout<<trunc(ans)<<endl;
      cout<<100000;
      return 0;
    }
    // for(int x=2;x<100;x++){
    //   double ans = 0;
    //   for (double i = 2; i <= 1e7; i++) {
    //     ans += (exp(1.0 / i, 1 - x) / (i - 1.0)) * 1e6;
    //   }
    //   // ll o = (ll) ans;
    //   // ll o = ceil(ans);
    //   // cout<<o;
    //   cout << trunc(ans) << endl;
    // }
    double ans = 0;
    for(double i=2;i<=end;i++){
      ans += (exp(1.0/i, 1-x)/(i-1.0))*1e6;
    }
    // ll o = (ll) ans;
    // ll o = ceil(ans);
    // cout<<o;
    cout<<trunc(ans)<<endl;

    return 0;
  }
0