NYOJ题目1162数字
-------------------------------------
我去写评测机的人好阴险啊竟然不让使用List....W( ̄_ ̄)W
然后Java强大的APi根本挡不住的好伐.....
用C写一大坨的java一行调用现成轮子搞定~
AC代码:
1 import java.io.BufferedReader; 2 import java.io.IOException; 3 import java.io.InputStreamReader; 4 import java.util.Arrays; 5 6 public class Main { 7 8 public static void main(String[] args) throws IOException { 9 10 BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); 11 12 int n=Integer.parseInt(reader.readLine()); 13 while(n-->0){ 14 int x[]=new int[100]; int index=0; 15 char cs[]=reader.readLine().toCharArray(); 16 boolean lastNotZero=false; 17 int value=0; 18 for(int i=0;i<cs.length;i++){ 19 if(cs[i]=='0'){ 20 if(lastNotZero) x[index++]=value; 21 lastNotZero=false; 22 value=0; 23 }else{ 24 lastNotZero=true; 25 value=value*10+cs[i]-'0'; 26 } 27 } 28 if(value!=0) x[index++]=value; 29 if(index==0){ 30 System.out.println(0); 31 continue; 32 } 33 Arrays.sort(x,0,index); 34 for(int i=0;i<index;i++) System.out.print(x[i]+" "); 35 System.out.println(); 36 } 37 38 } 39 40 }