結果

問題 No.379 五円硬貨
ユーザー nobigomunobigomu
提出日時 2018-05-01 00:14:08
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 881 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 5,336 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 08:33:48
合計ジャッジ時間 1,264 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require 'ffi'
local M = ffi.load 'gmp'

ffi.cdef [[
typedef unsigned long mp_bitcnt_t;
typedef unsigned long mp_limb_t;
typedef long mp_exp_t;
typedef struct {
	int _mp_prec;
	int _mp_size;
	mp_exp_t _mp_exp;
	mp_limb_t * _mp_d;
} __mpf_struct;
typedef __mpf_struct mpf_t[1];
typedef const __mpf_struct * mpf_srcptr;
typedef __mpf_struct * mpf_ptr;
void __gmpf_init_set_ui(mpf_ptr, unsigned long);
void __gmpf_div_ui(mpf_ptr, mpf_srcptr, unsigned long);
void __gmpf_mul_ui(mpf_ptr, mpf_srcptr, unsigned long);
void __gmpf_set_default_prec(mp_bitcnt_t);
int __gmp_printf(const char *, ...);
]]

M.__gmpf_set_default_prec(128ULL)
M.__gmp_printf("%.15Ff\n", (function (n, g, v)
	local t=ffi.new("mpf_t")
	M.__gmpf_init_set_ui(t,n/5ULL)
	M.__gmpf_mul_ui(t,t,g+0ULL)
	M.__gmpf_div_ui(t,t,v+0ULL)
	return t
end)(io.stdin:read("*n"), io.stdin:read("*n"), io.stdin:read("*n")))
0