Submission #16770533


Source Code Expand

Copy
s = gets.chomp.split('')
s << "0"
i = 0
count = 0
ans = 0
while i < s.size
  if s[i] == "2" && s[i+1] == "5"
    count += 1
    i += 1
  else
    ans += count*(count+1)/2
    count = 0
  end
  i += 1
end
puts ans

Submission Info

Submission Time
Task B - ニコニコ文字列
User asami
Language Ruby (2.7.1)
Score 100
Code Size 227 Byte
Status
Exec Time 97 ms
Memory 22672 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 30 / 30 70 / 70
Status
× 5
× 18
× 30
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
Subtask1 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt 61 ms 14180 KB
subtask0_sample_02.txt 62 ms 14076 KB
subtask0_sample_03.txt 66 ms 14144 KB
subtask0_sample_04.txt 64 ms 14048 KB
subtask0_sample_05.txt 62 ms 14200 KB
subtask1_01.txt 65 ms 14612 KB
subtask1_02.txt 64 ms 14492 KB
subtask1_03.txt 66 ms 14640 KB
subtask1_04.txt 64 ms 14460 KB
subtask1_05.txt 65 ms 14380 KB
subtask1_06.txt 65 ms 14468 KB
subtask1_07.txt 64 ms 14472 KB
subtask1_08.txt 63 ms 14308 KB
subtask1_09.txt 65 ms 14444 KB
subtask1_10.txt 62 ms 14268 KB
subtask1_11.txt 66 ms 14140 KB
subtask1_12.txt 65 ms 14544 KB
subtask1_13.txt 65 ms 14056 KB
subtask2_01.txt 97 ms 22480 KB
subtask2_02.txt 92 ms 21420 KB
subtask2_03.txt 95 ms 22672 KB
subtask2_04.txt 94 ms 21640 KB
subtask2_05.txt 86 ms 20336 KB
subtask2_06.txt 95 ms 21896 KB
subtask2_07.txt 89 ms 21572 KB
subtask2_08.txt 86 ms 21772 KB
subtask2_09.txt 67 ms 14616 KB
subtask2_10.txt 67 ms 14496 KB
subtask2_11.txt 66 ms 14664 KB
subtask2_12.txt 67 ms 14484 KB