結果

問題 No.207 世界のなんとか
ユーザー piconic_Xpiconic_X
提出日時 2015-11-08 16:53:12
言語 OCaml
(5.1.0)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 21,700 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 08:30:32
合計ジャッジ時間 976 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

let rec contain_3 n s =
  if n < 10 then
    let s = s + n in
    if n = 3 || (s <> 0 && s mod 3 = 0) || (s = 0 && n = 6 || n = 9) then true
    else false
  else
    let n1 = n mod 10 in
    if n1 = 3 then true
    else contain_3 (n / 10) (s + n1)

let nabeatsu2 a b =
  for i = a to b do
    if contain_3 i 0 then
      begin print_int i; print_newline () end
    else
      ()
  done

let () = Scanf.sscanf (read_line ()) "%d %d" nabeatsu2
0