Submission #2148004
Source Code Expand
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int t = in.nextInt(); String[] moji = new String[t]; int[] ans = new int[t]; for (int i = 0; i < t; i++) { moji[i] = in.next(); } for (int i = 0; i < t; i++) { int count = 0; String ins = moji[i]; for (int j = 0; j <= ins.length() - 5; j++) { String insmoji = ins.substring(j, j+5); if (insmoji.equals("kyoto") || insmoji.equals("tokyo")) { count++; j += 4; } } ans[i] = count; } for (int i : ans) { System.out.println(i); } } }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | tutuz |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 705 Byte |
Status | AC |
Exec Time | 114 ms |
Memory | 24276 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 | 113 ms | 24276 KB |
20_noised_tokyoto.txt | AC | 112 ms | 18900 KB |
99_teuchi.txt | AC | 114 ms | 21460 KB |