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 |
这题Java的正则表达式写起来碉堡了import java.io.*; import java.util.*; import java.util.regex.Pattern; public class Main { static Scanner cin=new Scanner(System.in); static PrintWriter cout=new PrintWriter(System.out,true); static public void main(String args[]) { String a; int tcase=cin.nextInt(); while(tcase-->0) { a=cin.next(); if(Pattern.compile("([+-]?[0-9]+)([/.][0-9]+)?([Ee][+-]?[0-9]+)?").matcher(a).matches()) cout.println("LEGAL"); else cout.println("ILLEGAL"); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator