結果
問題 | No.756 チャンパーノウン定数 (1) |
ユーザー |
|
提出日時 | 2025-03-03 12:10:22 |
言語 | Elixir (1.18.1) |
結果 |
AC
|
実行時間 | 548 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 7,075 ms |
コンパイル使用メモリ | 73,912 KB |
実行使用メモリ | 68,828 KB |
最終ジャッジ日時 | 2025-03-03 12:11:02 |
合計ジャッジ時間 | 20,831 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead. You may run "mix format --migrate" to fix this warning automatically. │ 18 │ s=IO.gets('') │ ~ │ └─ Main.exs:18:13
ソースコード
#!/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