結果

問題 No.83 最大マッチング
ユーザー naotest2naotest2
提出日時 2017-05-24 15:42:08
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 321 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 47,252 KB
最終ジャッジ日時 2023-10-19 20:02:28
合計ジャッジ時間 8,037 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
16,044 KB
testcase_01 AC 89 ms
16,044 KB
testcase_02 AC 83 ms
16,044 KB
testcase_03 AC 84 ms
16,044 KB
testcase_04 AC 85 ms
16,044 KB
testcase_05 AC 83 ms
16,044 KB
testcase_06 AC 84 ms
16,044 KB
testcase_07 AC 84 ms
16,044 KB
testcase_08 AC 84 ms
16,044 KB
testcase_09 AC 220 ms
22,220 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 = 0
  for num in 0..c-1
    if num == (c-1) and seven
      ret += 10 ** num * 7
    else
      ret += 10 ** num
    end
  end
  return ret
end

puts match(N)
0