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:大牛帮帮忙,测试数据都对,但一直WAIn 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator