結果
| 問題 | No.8072 Sum of sqrt(x) |
| ユーザー |
testestest
|
| 提出日時 | 2020-09-12 16:18:20 |
| 言語 | C (gcc 15.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 435 bytes |
| 記録 | |
| コンパイル時間 | 378 ms |
| コンパイル使用メモリ | 27,264 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-01-02 06:48:24 |
| 合計ジャッジ時間 | 95,144 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 13 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:29: warning: implicit declaration of function ‘sqrtl’ [-Wimplicit-function-declaration]
13 | ans[index]+=sqrtl(t);
| ^~~~~
main.c:2:1: note: include ‘<math.h>’ or provide a declaration of ‘sqrtl’
1 | #include<stdio.h>
+++ |+#include <math.h>
2 |
main.c:13:29: warning: incompatible implicit declaration of built-in function ‘sqrtl’ [-Wbuiltin-declaration-mismatch]
13 | ans[index]+=sqrtl(t);
| ^~~~~
main.c:13:29: note: include ‘<math.h>’ or provide a declaration of ‘sqrtl’
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%lld",&t);
| ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
long double ans[20];
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
long long t;
scanf("%lld",&t);
int index=0;
for(long long x=1;x<=t;x*=10)index++;
ans[index]+=sqrtl(t);
long double a=0;
for(int i=0;i<20;i++)a+=ans[i];
index=0;
for(long double x=1;x<=a;x*=10)index++;
char format[20];
sprintf(format,"%c%c%d%c%c%c",'%','.',17-index,'L','f','\n');
printf(format,a);
}
}
testestest