Skip to content

Instantly share code, notes, and snippets.

@Bekt
Last active December 11, 2015 04:59
Show Gist options
  • Select an option

  • Save Bekt/4549219 to your computer and use it in GitHub Desktop.

Select an option

Save Bekt/4549219 to your computer and use it in GitHub Desktop.
36
3 7
4 7
5 7
3 4
4 4
5 4
5 3
5 2
3 1
5 1
5 2
5 3
5 4
5 5
5 6
5 8
5 9
5 10
4 1
4 2
4 3
4 4
4 5
4 6
4 8
4 9
4 10
3 1
3 2
3 3
3 4
3 5
3 6
3 8
3 9
3 10
import java.io.*;
import java.util.*;
//2012: http://www.ccsc-ms.org/2012_Problems/pdfs/B-golf.pdf
//Status: AC
public class golf {
static Scanner in;
public static void main(String[] args) throws Exception {
in = new Scanner(new File("golf.in"));
new golf().run();
}
void run() {
int n = in.nextInt();
for (int i = 0; i < n; i++)
print(in.nextInt(), in.nextInt());
}
void print(int p, int s) {
if (s == 1) {
System.out.println("hole-in-one");
return;
}
int diff = s - p;
String text = null;
switch (diff) {
case -3:
text = "double-eagle"; break;
case -2:
text = "eagle"; break;
case -1:
text = "birdie"; break;
case 0:
text = "par"; break;
case 1:
text = "bogey"; break;
case 2:
text = "double-bogey"; break;
case 3:
text = "triple-bogey"; break;
case 4:
text = "four-over-par"; break;
case 5:
text = "five-over-par"; break;
case 6:
text = "six-over-par"; break;
case 7:
text = "seven-over-par"; break;
default: break;
}
System.out.println(text);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment