結果

問題 No.83 最大マッチング
ユーザー naotest2naotest2
提出日時 2017-05-24 15:46:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 426 ms / 5,000 ms
コード長 316 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 100,076 KB
最終ジャッジ日時 2023-10-19 20:02:54
合計ジャッジ時間 3,058 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
16,120 KB
testcase_01 AC 87 ms
16,120 KB
testcase_02 AC 86 ms
16,120 KB
testcase_03 AC 88 ms
16,120 KB
testcase_04 AC 86 ms
16,120 KB
testcase_05 AC 85 ms
16,120 KB
testcase_06 AC 89 ms
16,120 KB
testcase_07 AC 90 ms
16,120 KB
testcase_08 AC 88 ms
16,120 KB
testcase_09 AC 101 ms
31,168 KB
testcase_10 AC 308 ms
100,076 KB
testcase_11 AC 426 ms
100,076 KB
testcase_12 AC 421 ms
100,076 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N=gets.chomp.to_i

def match(n)
  # 6 => 9
  # 5 => 5
  # 4 => 4
  # 3 => 7
  # 2 => 1
  # 1 か 7しかない
  seven = n % 2 == 1
  c = (n.to_f / 2).to_i
  ret = ""
  for num in 0..c-1
    if num == (c-1) and seven
      ret = "7" + ret
    else
      ret = "1" + ret
    end
  end
  return ret
end

puts match(N)
0