本文共 850 字,大约阅读时间需要 2 分钟。
常规题 需要熟练
我卡壳的地方还是这里——“输入可能有多组测试数据”
一开始我写成了
String str=br.readLine();
while(str!=null)
{
}
然鹅,正确的写法是酱紫的
String str;
while(str=br.readLine()!=null)
{
}
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line; int y=0; int m=0; int d=0; while((line = br.readLine())!=null){ String str[]=line.split(" "); y=Integer.parseInt(str[0]); m=Integer.parseInt(str[1]); d=Integer.parseInt(str[2]); //判断闰年 int rmonth[]={31,29,31,30,31,30,31,31,30,31,30,31}; int pmonth[]={31,28,31,30,31,30,31,31,30,31,30,31}; int sum=0; if(y%4==0&&y%100!=0||y%400==0) { for(int i=0;i
转载地址:http://scssi.baihongyu.com/