結果
| 問題 |
No.8072 Sum of sqrt(x)
|
| ユーザー |
|
| 提出日時 | 2024-03-04 23:28:49 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1,932 ms / 2,000 ms |
| コード長 | 1,535 bytes |
| コンパイル時間 | 720 ms |
| コンパイル使用メモリ | 21,632 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-29 17:37:15 |
| 合計ジャッジ時間 | 145,255 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:46:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
46 | for(scanf("%d",&T);T--;){
| ^~~~~~~~~~~~~~
main.c:47:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | scanf("%lld",&x);
| ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <quadmath.h>
/// dlfcn.h ///
#ifdef __cplusplus
extern "C"{
#endif
#if defined(WIN32) || (!defined(__GNUC__) && !defined(__clang__))
void* LoadLibraryA(const char *x);
void* GetProcAddress(void *x,const char *y);
int FreeLibrary(void *x);
#elif defined(__APPLE__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || __GLIBC__ > 2))
void* dlopen(const char *x,int y);
void* dlsym(void *x,const char *y);
int dlclose(void *x);
#define LoadLibraryA(s) dlopen(s,2)
#define GetProcAddress dlsym
#define FreeLibrary dlclose
#else
void* __libc_dlopen_mode(const char *x,int y);
void* __libc_dlsym(void *x,const char *y);
int __libc_dlclose(void *x);
#define LoadLibraryA(s) __libc_dlopen_mode(s,2)
#define GetProcAddress __libc_dlsym
#define FreeLibrary __libc_dlclose
#endif
#ifdef __cplusplus
}
#endif
typedef __float128 (*type_sqrtq)(__float128);
typedef int (*type_quadmath_snprintf)(char *s, size_t size, const char *format, ...);
type_sqrtq mysqrtq;
type_quadmath_snprintf myquadmath_snprintf;
char buf[99];
int main(){
//void *H=LoadLibraryA("/usr/local/lib/gcc/10/libquadmath.dylib");
void *H=LoadLibraryA("/usr/lib/x86_64-linux-gnu/libquadmath.so.0");
mysqrtq=(type_sqrtq)GetProcAddress(H,"sqrtq");
myquadmath_snprintf=(type_quadmath_snprintf)GetProcAddress(H,"quadmath_snprintf");
int T;
long long x;
__float128 d=0;
for(scanf("%d",&T);T--;){
scanf("%lld",&x);
d+=mysqrtq(x);
myquadmath_snprintf(buf,99,"%.16Qg",d);
puts(buf);
}
return 0;
}