結果
問題 |
No.8072 Sum of sqrt(x)
|
ユーザー |
![]() |
提出日時 | 2021-10-26 01:57:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 863 bytes |
コンパイル時間 | 7,960 ms |
コンパイル使用メモリ | 356,500 KB |
最終ジャッジ日時 | 2025-01-25 06:59:12 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 4 TLE * 20 OLE * 3 |
ソースコード
#include <iostream> #include <ios> #include <iomanip> #include <boost/multiprecision/cpp_int.hpp> using namespace std; using namespace boost::multiprecision; typedef cpp_int Bint; Bint sqrt_floor(Bint x) { Bint ceil = x, floor = 1; while (ceil > floor + 1) { auto m = (ceil+floor)/2; if (m*m <= x) floor = m; else ceil = m; } return floor; } int main() { const int prec = 20; Bint unit = pow(Bint(10),prec); cout<<unit<<endl; int N; cin >> N; Bint ans = 0; for (auto i=0; i<N; ++i) { Bint x; cin >> x; auto p = sqrt_floor(x); cout << ans / unit << "." << setfill('0') << right << setw(prec - 3) << (ans % unit)/1000 << std::setfill(' ') << endl; } return 0; }