Submission #532939
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int tt=0;tt<t;tt++) { String s = sc.next(); int n = s.length(); int[] dp = new int[n+1]; for(int i=0;i<n-4;i++) { String ss = s.substring(i, i+5); if (ss.equals("tokyo") || ss.equals("kyoto")) { dp[i+5] = Math.max(dp[i+5],dp[i]+1); } dp[i+1] = Math.max(dp[i+1],dp[i]); } System.out.println(dp[n]); } } }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | piroz95 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 529 Byte |
Status | WA |
Exec Time | 465 ms |
Memory | 30316 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 0 / 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 | WA | 452 ms | 30316 KB |
20_noised_tokyoto.txt | WA | 465 ms | 30176 KB |
99_teuchi.txt | WA | 423 ms | 29464 KB |