結果
| 問題 | No.1118 sin(x)/xの二乗和 |
| コンテスト | |
| ユーザー |
fastmath
|
| 提出日時 | 2020-07-19 05:12:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 206 ms / 2,000 ms |
| コード長 | 906 bytes |
| コンパイル時間 | 1,621 ms |
| コンパイル使用メモリ | 166,512 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-15 19:06:33 |
| 合計ジャッジ時間 | 6,580 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
#define double long double
signed main() {
#ifdef HOME
freopen("input.txt", "r", stdin);
#else
#define endl '\n'
ios_base::sync_with_stdio(0); cin.tie(0);
#endif
double ans = 0;
double x;
cin >> x;
auto sinc = [] (double x) {
if (x == 0)
return (double)1.;
else
return sinl(x)/x;
};
for (; x < 1e6; ++x) {
auto t = sinc(x);
ans += t * t;
}
ans += 1. / (2 * x);
cout.precision(20);
cout << fixed;
cout << ans << endl;
}
fastmath