Submission #1688779


Source Code Expand

import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		String[] piano={"Do","","Re","","Mi","Fa","","So","","La","","Si"};
		int i=0;
		int fl=0;
		int firstw=-1;
		int secondw=-1;
		while(true){
			String now=s.substring(i,i+1);
			if(now.equals("W")){
				fl++;
				if(fl==2){
					fl=0;
					if(firstw==-1){
						firstw=i;
					}else{
						secondw=i;
						break;
					}
				}
			}else{
				fl=0;
			}
			i++;
		}
		if(secondw-firstw==5){
			System.out.println(piano[12-firstw]);

		}else{
			if(5-firstw>=0){
				System.out.println(piano[5-firstw]);
			}else{
				System.out.println(piano[12-(firstw-5)]);
			}
		}
	}
}

Submission Info

Submission Time
Task C - ピアニスト高橋君
User ri2112
Language Java8 (OpenJDK 1.8.0)
Score 100
Code Size 757 Byte
Status AC
Exec Time 95 ms
Memory 23380 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 1
AC × 8
Set Name Test Cases
Sample example_0.txt
All example_0.txt, handmade_0.txt, handmade_1.txt, handmade_2.txt, handmade_3.txt, handmade_4.txt, handmade_5.txt, handmade_6.txt
Case Name Status Exec Time Memory
example_0.txt AC 93 ms 18892 KB
handmade_0.txt AC 91 ms 19668 KB
handmade_1.txt AC 92 ms 23380 KB
handmade_2.txt AC 89 ms 21844 KB
handmade_3.txt AC 93 ms 22612 KB
handmade_4.txt AC 95 ms 20560 KB
handmade_5.txt AC 91 ms 20692 KB
handmade_6.txt AC 93 ms 20564 KB