Submission #5248437
Source Code Expand
# https://atcoder.jp/contests/kupc2015/tasks/kupc2015_a def count(s): def helper(s, acc): pos = -1 tokyo = s.find("oykot") kyoto = s.find("otoyk") if tokyo >= 0 and kyoto >= 0: pos = min(tokyo, kyoto) elif tokyo >= 0 and kyoto == -1: pos = tokyo elif tokyo == -1 and kyoto >= 0: pos = kyoto else: pos = -1 if pos == -1: res = acc else: res = helper(s[pos + 5 :], acc + 1) return res return helper(s, 0) N = int(input()) ss = ["".join(reversed(input())) for _ in range(N)] for s in ss: print(count(s))
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | vierbein |
Language | Python (3.4.3) |
Score | 100 |
Code Size | 703 Byte |
Status | AC |
Exec Time | 19 ms |
Memory | 3064 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
10_random_to_kyo.txt | AC | 18 ms | 3064 KB |
20_noised_tokyoto.txt | AC | 19 ms | 3064 KB |
99_teuchi.txt | AC | 18 ms | 3064 KB |