結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー 826814741_6826814741_6
提出日時 2018-12-21 02:27:02
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 964 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 5,260 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-26 01:15:56
合計ジャッジ時間 1,508 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

print((function (f, g)
	local h,t = f(),g(tonumber)
	if h[t.d] then h[t.d](t) end
	return ("%d/%02d/%02d"):format(t.y,t.m,t.d)
end)(function ()
	function isLY(t) return t.y%100==0 and t.y%400==0 or t.y%4==0 end
	function is30(t) return t.m==4 or t.m==6 or t.m==9 or t.m==11 end
	return {
		[29] = function (t) if t.m==2 and (not isLY(t)) then t.m,t.d = 3,1 end end;
		[30] = function (t) if t.m==2 then t.m,t.d = 3,isLY(t) and 1 or 2 end end;
		[31] = function (t)
			if t.m==2 then t.m,t.d = 3,2
			elseif is30(t) then t.m,t.d = t.m+1,1
			end end;
		[32] = function (t)
			if t.m==12 then t.y,t.m,t.d = t.y+1,1,1
			elseif is30(t) then t.m,t.d = t.m+1,2
			else t.m,t.d = t.m+1,1
			end end;
		[33] = function (t)
			if t.m==12 then t.y,t.m,t.d = t.y+1,1,2
			elseif is30(t) then t.m,t.d = t.m+1,3
			else t.m,t.d = t.m+1,2
			end end
	}
end, function (f)
	local y,m,d = io.stdin:read("*l"):match("(%d+)%/(%d+)%/(%d+)")
	return { y=f(y); m=f(m); d=f(d)+2 }
end))
0