結果

問題 No.723 2つの数の和
ユーザー nobigomunobigomu
提出日時 2018-08-05 14:26:54
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 28 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 5,516 KB
最終ジャッジ日時 2023-10-19 22:04:25
合計ジャッジ時間 1,234 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 20 ms
5,472 KB
testcase_04 AC 24 ms
5,472 KB
testcase_05 AC 21 ms
5,472 KB
testcase_06 AC 23 ms
5,516 KB
testcase_07 AC 12 ms
4,348 KB
testcase_08 AC 17 ms
5,004 KB
testcase_09 AC 24 ms
5,472 KB
testcase_10 AC 13 ms
4,348 KB
testcase_11 AC 4 ms
4,348 KB
testcase_12 AC 16 ms
4,960 KB
testcase_13 AC 24 ms
5,472 KB
testcase_14 AC 9 ms
4,348 KB
testcase_15 AC 13 ms
4,960 KB
testcase_16 AC 16 ms
5,004 KB
testcase_17 AC 21 ms
5,472 KB
testcase_18 AC 12 ms
4,348 KB
testcase_19 AC 15 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 15 ms
4,536 KB
testcase_24 AC 10 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require 'ffi'
local C = ffi.C
ffi.cdef 'int scanf(const char *, ...);'

print((function (n, x, cd)
	local a,h,r={},{},0
	for i=1,n do C.scanf("%d",cd) a[i]=cd[0] end
	for i=1,n do if h[a[i]]==nil then h[a[i]]=0 end h[a[i]]=h[a[i]]+1 end
	for i=1,n do if h[x-a[i]]~=nil then r=r+h[x-a[i]] end end
	return r
end)(io.stdin:read("*n"), io.stdin:read("*n"), ffi.new("int[1]")))
0