Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
 User ID: Password:
Register

## 大牛帮帮忙，测试数据都对，但一直WA

Posted by loveKid at 2009-01-21 01:02:13 on Problem 2572
```import java.util.Scanner;
public class Main {

public static int change(String str)
{int len=str.length();
int counter=0,sum=0;
char[]tem=str.toCharArray();
for(int i=len-1;i>=0;i--)
if(tem[i]=='0'){counter++;}
else break;
for(int j=0;j<len-counter;j++)
sum+=(tem[j]-48)*Math.pow(10, j);
return sum;
}
public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
while(2>1){
String str=cin.next();
String in1="",in2="",in3="";
int index=0;
char[]str0=str.toCharArray();
int length=str.length();
for(int i=0;i<length;i++)
{if(str0[i]=='+'){index=i;in1=str.substring(0,i);}
if(str0[i]=='='){in2=str.substring(index+1,i);in3=str.substring(i+1,length);}}
System.out.println(change(in1)+change(in2)==change(in3));
if(str.equals("0+0=0"))System.exit(0);
}
}

}
```

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator