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 |
Re:请大牛们帮忙看下为什么总是runtime error-_-!!!!! java!!In Reply To:请大牛们帮忙看下为什么总是runtime error-_-!!!!! java!! Posted by:sinceowa at 2010-04-28 00:59:59 > import java.io.*; > import java.util.*; > class Main{ > public static void main(String[] args)throws IOException{ > Scanner s=new Scanner(new BufferedInputStream(System.in)); > int j; > for(j=0;;j++){ > long m=s.nextLong(); > if(m==0) > break; > while(m>9){ > long samp=0; > String str=String.valueOf(m); > char[] ch=str.toCharArray(); > for(int i=0;i<ch.length;i++){ > samp+=ch[i]-48; > } > m=samp; > } > System.out.println(m); > } > > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator