結果
| 問題 |
No.8072 Sum of sqrt(x)
|
| ユーザー |
chocorusk
|
| 提出日時 | 2020-09-13 00:47:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,640 ms / 2,000 ms |
| コード長 | 1,623 bytes |
| コンパイル時間 | 1,327 ms |
| コンパイル使用メモリ | 125,364 KB |
| 最終ジャッジ日時 | 2025-01-14 14:09:12 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘lll sqrt(lll)’:
main.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
33 | }
| ^
main.cpp: In function ‘int main()’:
main.cpp:37:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
37 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:41:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
41 | scanf("%lld", &x);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using lll=__int128_t;
lll sqrt(lll x){
if(x==0) return 0;
}
int main()
{
int n;
scanf("%d", &n);
long double ans=0, r=0;
for(int i=0; i<n; i++){
ll x;
scanf("%lld", &x);
long double a=sqrt((long double)x);
long double t=ans+a+r;
r=a+r-(t-ans);
ans=t;
if(ans<1e1) printf("%.16Lf\n", ans);
else if(ans<1e2) printf("%.15Lf\n", ans);
else if(ans<1e3) printf("%.14Lf\n", ans);
else if(ans<1e4) printf("%.13Lf\n", ans);
else if(ans<1e5) printf("%.12Lf\n", ans);
else if(ans<1e6) printf("%.11Lf\n", ans);
else if(ans<1e7) printf("%.10Lf\n", ans);
else if(ans<1e8) printf("%.9Lf\n", ans);
else if(ans<1e9) printf("%.8Lf\n", ans);
else if(ans<1e10) printf("%.7Lf\n", ans);
else if(ans<1e11) printf("%.6Lf\n", ans);
else if(ans<1e12) printf("%.5Lf\n", ans);
else if(ans<1e13) printf("%.4Lf\n", ans);
else if(ans<1e14) printf("%.3Lf\n", ans);
else printf("%.2Lf\n", ans);
}
return 0;
}
chocorusk