Created
January 18, 2016 15:09
-
-
Save chyiiiiiiiiiiii/864abb7e8d8d0fdb589f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String argv[]) { | |
Scanner input = new Scanner(System.in); | |
int n = input.nextInt(); | |
for (int i = 0; i < n; i++) { | |
String ask = input.next(); | |
int index = check(ask); | |
String[] a = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#","A", "A#", "B", "C", "C#", "D", | |
"D#", "E", "F", "F#", "G","G#", "A", "A#", "B" }; | |
if (ask.length()==2) { | |
System.out.printf("%s %s %s", ask.charAt(0), a[index + 3],a[index + 7]); | |
} else { | |
System.out.printf("%s %s %s", ask.charAt(0), a[index + 4],a[index + 7]); | |
} | |
System.out.println(); | |
} | |
} | |
public static int check(String ask) { | |
switch (ask.charAt(0)) { | |
case 'C': | |
return 0; | |
case 'D': | |
return 2; | |
case 'E': | |
return 4; | |
case 'F': | |
return 5; | |
case 'G': | |
return 7; | |
case 'A': | |
return 9; | |
case 'B': | |
return 11; | |
} | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment