标签:
原题如下
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan =new Scanner(System.in);
int n, m;
while (scan.hasNext()) {
n = scan.nextInt();
String c=scan.nextLine();
//m = scan.nextInt();
while(n!=0){
n--;
String s=scan.nextLine();
int judge;
if(s.matches("[a-z_A-Z][a-z_A-Z0-9]{0,}"))
judge=1;
else judge=0;
if(judge==1)
System.out.println("yes");
else
System.out.println("no");
}
}
}
}
这道水题主要有两点需要注意,一是读取空格的问题需要用到scan.nextLine();二是matches的用法
标签:
原文地址:http://www.cnblogs.com/cwenliu/p/5752504.html