博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
机试题:今年的第几天?
阅读量:4107 次
发布时间:2019-05-25

本文共 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/

你可能感兴趣的文章
MFC矩阵运算
查看>>
最小二乘法拟合:原理,python源码,C++源码
查看>>
ubuntu 安装mysql
查看>>
c# 计算器
查看>>
C# 简单的矩阵运算
查看>>
gcc 常用选项详解
查看>>
c++输入文件流ifstream用法详解
查看>>
c++输出文件流ofstream用法详解
查看>>
字符编码:ASCII,Unicode 和 UTF-8
查看>>
QT跨MinGW和MSVC两种编译器的解决办法
查看>>
firewalld的基本使用
查看>>
Linux下SVN客户端使用教程
查看>>
i2c-tools
查看>>
Linux分区方案
查看>>
nc 命令详解
查看>>
如何使用 systemd 中的定时器
查看>>
git命令速查表
查看>>
linux进程监控和自动重启的简单实现
查看>>
OpenFeign学习(三):OpenFeign配置生成代理对象
查看>>
OpenFeign学习(四):OpenFeign的方法同步请求执行
查看>>