fork download
  1. /* package whatever; // don't place package name! */
  2. import java.util.*;
  3.  
  4. class Dice{
  5. private int num;
  6. private int cnt;
  7. static int biggest_Num = 0; //가장 큰 수
  8. static int biggest_Cnt = 0; //같은 눈이 나온 횟수
  9. static int biggest_Cnt_Num = 0; //같은 눈
  10.  
  11. Dice(int num){
  12. this.num = num;
  13. cnt = 0;
  14. biggest_Num = (biggest_Num > num) ? biggest_Num : num;
  15. }
  16.  
  17. //중복 확인
  18. public void diceCheck(Dice[] d, int index) {
  19. for(int i = index; i - 1 >= 0; i--)
  20. if(d[index].num == d[i - 1].num)
  21. cnt++;
  22.  
  23. if(biggest_Cnt < cnt) {
  24. biggest_Cnt = cnt;
  25. biggest_Cnt_Num = num;
  26. }
  27. }
  28.  
  29. //상금 계산
  30. static int prizeMoney() {
  31. int result;
  32. switch(Dice.biggest_Cnt) {
  33. case 1: result = 1000 + Dice.biggest_Cnt_Num * 100; break;
  34. case 2: result = 10000 + Dice.biggest_Cnt_Num * 1000; break;
  35. default: result = Dice.biggest_Num * 100; break;
  36. }
  37. return result;
  38. }
  39. }
  40.  
  41. /* Name of the class has to be "Main" only if the class is public. */
  42. class Ideone
  43. {
  44. public static void main (String[] args) throws java.lang.Exception
  45. {
  46. // your code goes here
  47. Scanner sc = new Scanner(System.in);
  48. Dice[] d = new Dice[3];
  49.  
  50. d[0] = new Dice(sc.nextInt());
  51. for(int i = 1; i < 3; i++) {
  52. d[i] = new Dice(sc.nextInt());
  53. d[i].diceCheck(d, i);
  54. }
  55.  
  56. System.out.println(Dice.prizeMoney());
  57. sc.close();
  58. }
  59. }
Success #stdin #stdout 0.13s 51428KB
stdin
3 3 6
stdout
1300