Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
HELP1007 JAVA打印语句为什么不执行? import java.util.Scanner; import java.util.Arrays; public class Main { int n = 0, m = 0; public Main() { Scanner cin = new Scanner(System.in); n = cin.nextInt(); m = cin.nextInt(); int[] s = new int[m]; String[] str = new String[m]; cin.nextLine(); for(int i = 0; i < m; i++) { str[i] = cin.nextLine(); s[i] = deal(str[i]); } int[] ss = new int[m]; for(int f = 0; f < m; f++) { ss[f] = s[f]; } Arrays.sort(ss); for(int h = 0; h > m - 1; h++) { System.out.println("hello!"); for(int p = 0; p < m; p++) { if(s[p] == ss[h]){ System.out.println(str[p]); s[p] = -1; } } } } private boolean check(char a, char b) { return a > b? true: false; } private int deal(String str) { int t = 0; for(int j = 0; j < str.length(); j++) { for(int i = j + 1; i < str.length(); i++) { if(check(str.charAt(j),str.charAt(i))) t++; } } return t; } static public void main(String args[]) { Main m = new Main(); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator