結果

問題 No.3072 Sum of sqrt(x)
ユーザー cielciel
提出日時 2021-05-03 13:16:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,429 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 30,332 KB
実行使用メモリ 5,072 KB
最終ジャッジ日時 2023-09-02 17:14:12
合計ジャッジ時間 161,230 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 3 ms
4,368 KB
testcase_02 AC 3 ms
4,368 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 3 ms
4,368 KB
testcase_05 AC 3 ms
4,372 KB
testcase_06 AC 3 ms
4,372 KB
testcase_07 AC 1,609 ms
4,372 KB
testcase_08 AC 423 ms
4,376 KB
testcase_09 AC 868 ms
4,376 KB
testcase_10 AC 1,753 ms
4,376 KB
testcase_11 AC 1,763 ms
4,376 KB
testcase_12 TLE -
testcase_13 AC 1,845 ms
4,372 KB
testcase_14 AC 1,829 ms
4,372 KB
testcase_15 AC 1,821 ms
4,372 KB
testcase_16 AC 1,818 ms
4,376 KB
testcase_17 AC 1,765 ms
4,376 KB
testcase_18 AC 1,832 ms
4,376 KB
testcase_19 AC 1,760 ms
4,372 KB
testcase_20 AC 1,780 ms
4,376 KB
testcase_21 AC 1,835 ms
4,372 KB
testcase_22 AC 1,777 ms
4,372 KB
testcase_23 AC 1,742 ms
4,372 KB
testcase_24 AC 1,806 ms
4,376 KB
testcase_25 AC 1,771 ms
4,372 KB
testcase_26 AC 1,767 ms
4,376 KB
testcase_27 AC 1,694 ms
4,372 KB
testcase_28 AC 1,638 ms
4,376 KB
testcase_29 AC 1,721 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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__)
	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/lib64/libquadmath.so");
	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;
}
0