結果

問題 No.1118 sin(x)/xの二乗和
ユーザー hitonanode
提出日時 2020-07-17 21:34:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 866 bytes
コンパイル時間 1,920 ms
コンパイル使用メモリ 196,592 KB
最終ジャッジ日時 2025-01-11 22:19:36
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops", "fast-math") 
#pragma GCC target("avx")
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;


int main()
{
    double x;
    cin >> x;
    double ret = 0.0;
    if (x == 0) ret = 1;
    else
    {
        double s = sin(x) / x;
        ret += s * s;
    }
    FOR(j, 1, 4e7) {
        double y = x + j;
        double s = sin(y) / y;
        ret += s * s;
    }
    cout << ret << '\n';
}
0