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

Re:大牛帮帮忙,测试数据都对,但一直WA

Posted by fishing_test at 2009-05-18 10:20:52 on Problem 2572
In Reply To:大牛帮帮忙,测试数据都对,但一直WA Posted by:loveKid at 2009-01-21 01:02:13
why not using regular expression.

my code:
            if ("0+0=0".equals(line.trim())) {
                System.out.println("True");
                break;
            }
            
            String[] t = line.split("[+=]");
            
            int n1 = Integer.parseInt(new StringBuffer(t[0]).reverse().toString());
            int n2 = Integer.parseInt(new StringBuffer(t[1]).reverse().toString());
            int n3 = Integer.parseInt(new StringBuffer(t[2]).reverse().toString());
            
            
            if (n1 + n2 == n3) {
                System.out.println("True");
            } else {
                System.out.println("False");
            }

Followed by:

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

Content:

Home Page   Go Back  To top


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