Submission #237125


Source Code Expand

 
a, k = gets.split(' ').map{|i| i.to_i}

result = 0

as = a.to_s

koho = 0
1.upto(120000) do |i|
  cnt = {}
  i.to_s.split('').each do |c|
    cnt[c] = 0
  end
  if cnt.size <= k
    if (koho - a).abs > (i - koho).abs
      koho = i
    end
  end
end

puts (koho - a).abs

Submission Info

Submission Time
Task D - 壊れた電卓
User yantene
Language Ruby (1.9.3)
Score 0
Code Size 292 Byte
Status WA
Exec Time 1333 ms
Memory 4404 KB

Compile Error

./Main.rb:21: warning: (...) interpreted as grouped expression

Judge Result

Set Name sub All
Score / Max Score 0 / 30 0 / 70
Status
AC × 8
WA × 24
AC × 9
WA × 44
Set Name Test Cases
sub test_01A.txt, test_02A.txt, test_04A.txt, test_05A.txt, test_07A.txt, test_09A.txt, test_10A.txt, test_11A.txt, test_12A.txt, test_13A.txt, test_15A.txt, test_17A.txt, test_18A.txt, test_19A.txt, test_21A.txt, test_22A.txt, test_23A.txt, test_25A.txt, test_27A.txt, test_28A.txt, test_29A.txt, test_31A.txt, test_33A.txt, test_34A.txt, test_35A.txt, test_37A.txt, test_38A.txt, test_40A.txt, test_42A.txt, test_44A.txt, test_46A.txt, test_48A.txt
All test_01A.txt, test_02A.txt, test_03.txt, test_04A.txt, test_05A.txt, test_06.txt, test_07A.txt, test_08.txt, test_09A.txt, test_10A.txt, test_11A.txt, test_12A.txt, test_13A.txt, test_14.txt, test_15A.txt, test_16.txt, test_17A.txt, test_18A.txt, test_19A.txt, test_20.txt, test_21A.txt, test_22A.txt, test_23A.txt, test_24.txt, test_25A.txt, test_26.txt, test_27A.txt, test_28A.txt, test_29A.txt, test_30.txt, test_31A.txt, test_32.txt, test_33A.txt, test_34A.txt, test_35A.txt, test_36.txt, test_37A.txt, test_38A.txt, test_39.txt, test_40A.txt, test_41.txt, test_42A.txt, test_43.txt, test_44A.txt, test_45.txt, test_46A.txt, test_47.txt, test_48A.txt, test_49.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1265 ms 4332 KB
sample_02.txt WA 1245 ms 4332 KB
sample_03.txt WA 1287 ms 4332 KB
sample_04.txt WA 1254 ms 4332 KB
test_01A.txt WA 1242 ms 4328 KB
test_02A.txt AC 1269 ms 4332 KB
test_03.txt WA 1243 ms 4332 KB
test_04A.txt WA 1275 ms 4332 KB
test_05A.txt WA 1269 ms 4328 KB
test_06.txt WA 1269 ms 4332 KB
test_07A.txt AC 1233 ms 4332 KB
test_08.txt WA 1244 ms 4336 KB
test_09A.txt WA 1268 ms 4332 KB
test_10A.txt WA 1332 ms 4332 KB
test_11A.txt AC 1255 ms 4332 KB
test_12A.txt WA 1281 ms 4332 KB
test_13A.txt WA 1269 ms 4332 KB
test_14.txt WA 1291 ms 4328 KB
test_15A.txt WA 1292 ms 4332 KB
test_16.txt WA 1268 ms 4312 KB
test_17A.txt AC 1225 ms 4332 KB
test_18A.txt WA 1333 ms 4332 KB
test_19A.txt WA 1276 ms 4324 KB
test_20.txt WA 1243 ms 4332 KB
test_21A.txt WA 1281 ms 4332 KB
test_22A.txt WA 1262 ms 4328 KB
test_23A.txt WA 1307 ms 4332 KB
test_24.txt WA 1258 ms 4328 KB
test_25A.txt WA 1238 ms 4332 KB
test_26.txt WA 1256 ms 4332 KB
test_27A.txt WA 1267 ms 4328 KB
test_28A.txt WA 1269 ms 4332 KB
test_29A.txt WA 1273 ms 4328 KB
test_30.txt WA 1261 ms 4332 KB
test_31A.txt WA 1293 ms 4320 KB
test_32.txt WA 1280 ms 4332 KB
test_33A.txt WA 1260 ms 4332 KB
test_34A.txt WA 1265 ms 4376 KB
test_35A.txt WA 1269 ms 4332 KB
test_36.txt WA 1253 ms 4332 KB
test_37A.txt WA 1258 ms 4328 KB
test_38A.txt WA 1250 ms 4332 KB
test_39.txt WA 1226 ms 4332 KB
test_40A.txt AC 1268 ms 4328 KB
test_41.txt WA 1272 ms 4332 KB
test_42A.txt AC 1281 ms 4360 KB
test_43.txt WA 1293 ms 4404 KB
test_44A.txt AC 1246 ms 4360 KB
test_45.txt WA 1273 ms 4336 KB
test_46A.txt AC 1261 ms 4332 KB
test_47.txt WA 1271 ms 4332 KB
test_48A.txt WA 1275 ms 4356 KB
test_49.txt WA 1326 ms 4332 KB