結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー harhogefooharhogefoo
提出日時 2016-11-24 20:34:27
言語 Ruby
(3.3.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 11,364 KB
実行使用メモリ 15,308 KB
最終ジャッジ日時 2023-08-18 07:10:26
合計ジャッジ時間 2,666 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,176 KB
testcase_01 AC 83 ms
15,124 KB
testcase_02 AC 86 ms
15,304 KB
testcase_03 AC 88 ms
15,052 KB
testcase_04 AC 87 ms
15,168 KB
testcase_05 AC 83 ms
15,168 KB
testcase_06 AC 85 ms
15,100 KB
testcase_07 AC 86 ms
15,308 KB
testcase_08 AC 84 ms
15,124 KB
testcase_09 AC 87 ms
15,024 KB
testcase_10 AC 83 ms
15,248 KB
testcase_11 AC 84 ms
15,188 KB
testcase_12 AC 88 ms
15,184 KB
testcase_13 AC 84 ms
15,252 KB
testcase_14 AC 82 ms
15,224 KB
testcase_15 AC 85 ms
15,260 KB
testcase_16 AC 85 ms
15,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a = gets.chomp
b = gets.chomp

def check_has_str(str)
  str.each_char do |c|
    if c !~ /\d+/
      puts 'NG'
      exit
    end
  end
end

def check_zero_digit(str)
  if str.length < 2
    return
  end

  str.each_char do |c|
    if c == '0'
      puts 'NG'
      exit
    else
      return
    end
  end
end

def check_over_12345(num)
  if num > 12345
    puts 'NG'
    exit
  end
end

check_has_str(a)
check_has_str(b)
check_zero_digit(a)
check_zero_digit(b)
check_over_12345(a.to_i)
check_over_12345(b.to_i)

puts 'OK'
0