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

这题Java的正则表达式写起来碉堡了

Posted by speedcell4 at 2012-08-10 18:27:59 on Problem 3332
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:
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