HDU 2005
来源:互联网 发布:高速公路收费查询软件 编辑:程序博客网 时间:2024/05/22 06:05
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2005
题目大意:中文题
题目思路:判断是否为闰年,将月份总天数和当前天数相加。输入使用scanf()。
代码:
#include<stdio.h>bool ifrun(int x){ if ((x % 4 == 0 && x % 100 != 0) || (x % 400 == 0))return 1; else return 0;}int main(){ int y, m, d; int run[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int norun[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; while (~scanf("%d/%d/%d", &y, &m, &d)) { int sum = 0; if (ifrun(y)) { for (int i = 0; i < m - 1; i++) sum += run[i]; } else for (int i = 0; i < m - 1; i++) sum += norun[i]; printf("%d\n", sum + d); }}
阅读全文
0 0
- hdu 2005
- hdu 2005
- HDU 2005
- HDU-2005
- hdu 2005
- HDU 2005
- HDU 2005
- HDU 2005
- HDU-2005
- HDU 2005
- HDU-2005
- hdu 2005
- HDU 2005
- hdu 2005 第几天
- hdu 2005 java_calendar
- HDU 2005 第几天
- HDU 2005 第几天?
- hdu 2005 第几天?
- 企业微信内自创建app 获取用户信息问题
- 设计模式之创建型模式(2)--工厂模式
- MyBatis-Spring整合 注入SqlSessionTemplate
- GPU异构编程模型
- Struts2上传文件的最大Size的设置
- HDU 2005
- Android TextView 改变字体方法
- linux中的strip命令简介------给文件脱衣服
- jQuery
- 毕业设计(商城系统)
- 常见BUG Software caused connection abort: socket write error
- 十字链表的AOI算法实现
- MyBatis-Spring(二)使用注解
- AlertDialog 详解