結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー cielciel
提出日時 2018-12-06 12:51:54
言語 Elixir
(1.16.2)
結果
AC  
実行時間 655 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 1,105 ms
コンパイル使用メモリ 55,704 KB
実行使用メモリ 49,928 KB
最終ジャッジ日時 2023-08-29 23:11:06
合計ジャッジ時間 17,714 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 642 ms
49,752 KB
testcase_01 AC 628 ms
49,752 KB
testcase_02 AC 639 ms
49,224 KB
testcase_03 AC 650 ms
49,844 KB
testcase_04 AC 647 ms
49,816 KB
testcase_05 AC 649 ms
48,976 KB
testcase_06 AC 649 ms
49,312 KB
testcase_07 AC 642 ms
49,096 KB
testcase_08 AC 646 ms
49,716 KB
testcase_09 AC 642 ms
49,856 KB
testcase_10 AC 648 ms
49,264 KB
testcase_11 AC 645 ms
49,160 KB
testcase_12 AC 640 ms
49,208 KB
testcase_13 AC 633 ms
49,316 KB
testcase_14 AC 636 ms
49,084 KB
testcase_15 AC 625 ms
49,288 KB
testcase_16 AC 639 ms
49,928 KB
testcase_17 AC 629 ms
48,944 KB
testcase_18 AC 629 ms
49,212 KB
testcase_19 AC 629 ms
49,180 KB
testcase_20 AC 639 ms
49,196 KB
testcase_21 AC 648 ms
49,324 KB
testcase_22 AC 655 ms
49,196 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable "main" does not exist and is being expanded to "main()", please use parentheses to remove the ambiguity or change the variable name
  Main.exs:23: Main.main/0

ソースコード

diff #

#!/usr/bin/env elixir
defmodule Main do
	def calc2(d,num,bse) do
		if d==0 do
			rem(num,bse)
		else
			calc2(d-1,div(num,bse),bse)
		end
	end
	def calc(digits,expbase,bse,x,n) do
		if x>n do
			calc2(digits-1-rem(n,digits),expbase+div(n,digits),bse)
		else
			calc(digits+1,expbase*bse,bse,(digits+1)*(expbase*bse)*(bse-1),n-x)
		end
	end
	def main() do
		s=IO.gets('')
		if s != :eof do
			n=elem Integer.parse(s),0
			if n != 0 do
				IO.puts calc(1,1,10,9,n-1)
				main
			end
		end
	end
end
Main.main
0