結果
問題 | No.1271 初めての級数 |
ユーザー |
![]() |
提出日時 | 2020-10-30 21:39:48 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 796 bytes |
コンパイル時間 | 1,312 ms |
使用メモリ | 9,756 KB |
最終ジャッジ日時 | 2023-02-21 11:34:38 |
合計ジャッジ時間 | 2,341 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
7,576 KB |
testcase_01 | AC | 6 ms
7,596 KB |
testcase_02 | AC | 5 ms
9,688 KB |
testcase_03 | AC | 6 ms
7,596 KB |
testcase_04 | AC | 6 ms
7,672 KB |
testcase_05 | AC | 6 ms
9,756 KB |
testcase_06 | AC | 5 ms
7,660 KB |
testcase_07 | AC | 5 ms
7,592 KB |
testcase_08 | AC | 6 ms
7,568 KB |
testcase_09 | AC | 6 ms
7,680 KB |
testcase_10 | AC | 5 ms
9,700 KB |
testcase_11 | AC | 6 ms
7,724 KB |
testcase_12 | AC | 6 ms
7,564 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0) #define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0) template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;} const char newl = '\n'; int main() { int n; cin >> n; double ans = 0; for (double i = 1;i < 2e6;i += 1) ans += 1/(i*(i+n)); cout << fixed << setprecision(9) << ans << newl; }