F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_6013763_27311\Main.java:1: illegal start of expression
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner sca = new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = sca.nextInt(); for(int i = 0; i < n; i++) { int[] num1 = new int[1024]; int[] num2 = new int[1024]; int[] ans = new int[1024]; int borrow = 0; String str = br.readLine(); char[] line = str.toCharArray(); int j = 0, k = 0; int length,length1,length2; while (j < line.length && line[j] != ' ') ++j; for(int l = j - 1; l >= 0; l--) { num1[k] = (int)line[l] - 48; ++k; } length1 = k; k = 0; ++j; int s = j; while(j < line.length) ++j; for(int l = j - 1; l >= s; l--) { num2[k] = (int)line [l] - 48; ++k; } length2 = k; j = 0; while(j < length1 && j < length2) { ans[j] = num1[j] + num2[j] + borrow; borrow = ans[j] / 10; ans[j] %= 10; ++j; } if(j >= length1) { while(j < length2) { ans[j] = num2[j] + borrow; borrow = ans[j] / 10; ans[j] %= 10; ++j; } } if(j >= length2) { while(j < length1) { ans[j] = num1[j] + borrow; borrow = ans[j] / 10; ans[j] %= 10; ++j; } } if(borrow == 1) { ans[j] = 1; ++j; } length = j; while (length > 1&&ans[length - 1] == 0 ) --length; System.out.println("Case " + (i + 1) + ":"); for(j = length1 - 1; j >= 0; j--) System.out.print(num1[j]); System.out.print(" + "); for(j = length2 - 1; j >= 0; j--) System.out.print(num2[j]); System.out.print(" = "); for(j = length - 1; j >= 0; j--) System.out.print(ans[j]); System.out.println(); if(i != n - 1) System.out.printf("\r\n"); } } }


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 10:17:25, Gzip enabled