本文主要是介绍求助!!!杭电 1004 Let the balloon rise (Wrong Answer),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
不知道为什么,这道题一直Wrong Answer,哪位大神帮我看看吧!谢啦!
import java.util.Scanner;public class Main {public static void main(String[] args) {Color c = new Color();c.give();}}class Color {public void give(){Scanner input = new Scanner(System.in);int value = input.nextInt();String[] array = new String[value];for(int i = 0 ; i <value; i ++){array[i] = input.next();}Calculate cal = new Calculate();cal.allTogether(array, value);}
}class Calculate {public void allTogether(String[] arrayF2, int value){if(value != 0){int max = 0;String array2 = null;if(value != 1){for(int i = 0; i < arrayF2.length - 1; i ++){int sum = 0;for(int j = i + 1;j < arrayF2.length; j ++){if(arrayF2[i].equals(arrayF2[j])){sum ++;}}if(sum > max){max = sum;array2 = arrayF2[i];}}}else{array2 = arrayF2[0];}System.out.println(array2);Color c = new Color();c.give(); }}
}
这篇关于求助!!!杭电 1004 Let the balloon rise (Wrong Answer)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!