結果

問題 No.1118 sin(x)/xの二乗和
ユーザー karinohitokarinohito
提出日時 2021-09-07 00:05:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,851 ms / 2,000 ms
コード長 1,025 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 165,756 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 18:42:09
合計ジャッジ時間 39,933 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,761 ms
4,376 KB
testcase_01 AC 1,760 ms
4,376 KB
testcase_02 AC 1,761 ms
4,376 KB
testcase_03 AC 1,762 ms
4,380 KB
testcase_04 AC 1,760 ms
4,376 KB
testcase_05 AC 1,767 ms
4,380 KB
testcase_06 AC 1,767 ms
4,380 KB
testcase_07 AC 1,760 ms
4,376 KB
testcase_08 AC 1,851 ms
4,376 KB
testcase_09 AC 1,779 ms
4,380 KB
testcase_10 AC 1,763 ms
4,380 KB
testcase_11 AC 1,763 ms
4,376 KB
testcase_12 AC 1,761 ms
4,380 KB
testcase_13 AC 1,759 ms
4,380 KB
testcase_14 AC 1,765 ms
4,380 KB
testcase_15 AC 1,761 ms
4,380 KB
testcase_16 AC 1,762 ms
4,376 KB
testcase_17 AC 1,763 ms
4,376 KB
testcase_18 AC 1,760 ms
4,384 KB
testcase_19 AC 1,764 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<ll>>;
ll mod=1e9+7;
ll modPow(long long a, long long n, long long p) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

ll stll(string S) {
    ll n = 0;
    ll k = 1;
    rep(i, S.size()) {
        n += (k * int(S[S.size() - i - 1]-'0'));
        k *= 10;
        k %= mod;
        n %= mod;
    }
    return n;
}
ll A,B,C,D,P,Q;
ll F(ll X){
  return A*X*X*X+B*X*X+C*X+D;
}
int main() {
    double X;
    cin>>X;
    ll N=1e8;
    double an=0;
    rep(i,N){
      if(X+i==0)an+=1.0;
      else {
        double k=sin(X+i)/(double(X)+double(i));
        k*=k;
        an+=k;
      }
    }
    an+=1/(2*(X+N+0.5));
    cout<<setprecision(16)<<an<<endl;
}
0