結果

問題 No.1180 無限和
ユーザー kyoprounokyoprouno
提出日時 2020-08-21 23:14:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,041 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 173,888 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-15 06:19:41
合計ジャッジ時間 3,128 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;


template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll INF=1e9+7;

const ll mod=1e9+7;

int main(){
    long double n;
    cin >> n;
    if(n==1){
        cout << 1 << endl;
        return 0;
    }
    long double ans=0.0;
    ll k=100000;
    
    ans+=1.0/n;
    rep(i,k){
        if(i==0 || i==1) continue;
        ans+=n/(i*i*n-(i-1));
    }
    ans+=acos(-1)*acos(-1)/6.0-1;
    ll v=ans;
    cout << v << endl;
    return 0;
    
}
0