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 |
我的程序为何WA?import java.io.*; import java.util.*; public class Main { public static void main(String args[]) throws Exception { int array1[]=new int[1000001]; int array2[]=new int[1000001]; int sum[]=new int[1000001]; int i; int ci=0; BufferedReader stdin = new BufferedReader( new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(stdin.readLine()); int N=Integer.parseInt(st.nextToken()); for(i=0;i<N;i++){ st = new StringTokenizer(stdin.readLine()); array1[i]=Integer.parseInt(st.nextToken()); array2[i]=Integer.parseInt(st.nextToken()); sum[i]=0; } for(i=N-1;i>=0;i--){ sum[i]=(array1[i]+array2[i]+ci)%10; ci=(array1[i]+array2[i])/10; } for(i=0;i<N;i++){ System.out.print(sum[i]); } System.out.println(); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator