結果
| 問題 | No.8072 Sum of sqrt(x) |
| ユーザー |
|
| 提出日時 | 2020-09-26 13:35:53 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 627 bytes |
| 記録 | |
| コンパイル時間 | 1,939 ms |
| コンパイル使用メモリ | 194,892 KB |
| 最終ジャッジ日時 | 2025-01-14 22:16:34 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 4 WA * 3 RE * 20 |
コンパイルメッセージ
main.cpp: In function ‘char getcha()’:
main.cpp:10:10: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | fread(cn, 1, cm, stdin);
| ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
if (ci - cn == cm) {
fread(cn, 1, cm, stdin);
ci = cn;
}
return *ci++;
}
inline int getint() {
int A = 0;
if (ci - cn + 16 > cm) {
while ((ct = getcha()) >= '0') {
A = A * 10 + ct - '0';
}
} else {
while ((ct = *ci++) >= '0') {
A = A * 10 + ct - '0';
}
}
return A;
}
int main() {
int n = getint();
long double ans = 0;
while (n--) {
int x = getint();
ans += sqrt((long double)x);
puts(to_string(ans).c_str());
}
return 0;
}