BUPTOJ 0087-0089
来源:互联网 发布:ubuntu cuda caffe 编辑:程序博客网 时间:2024/06/02 23:27
这三道略水,做得很顺利。
BUPTOJ 0087日期
/*USER_ID: test#aa3615058PROBLEM: 87SUBMISSION_TIME: 2014-03-19 21:08:42*/#include <iostream>#include <stdio.h>using namespace std; bool isLeapYear(int year); int main() { int days[12] = {0,31,59,90,120,151,181,212,243,273,304,334}; int y,m,d; int caseCount = 0; cin >> caseCount; for(int i = 0; i < caseCount; i++) { scanf("%d:%d:%d", &y, &m, &d); if(m > 2 && isLeapYear(y)) { cout << (days[m-1]+d+1) << endl; } else { cout << (days[m-1]+d) << endl; } } return 0;} bool isLeapYear(int year) { if(year % 100 == 0) { if(year % 400 == 0) { return true; } else { return false; } } else if(year % 4 == 0) { return true; } else { return false; }}
BUPTOJ 0088最值问题
/*USER_ID: test#aa3615058PROBLEM: 88SUBMISSION_TIME: 2014-03-19 21:35:37*/#include <iostream>using namespace std; int main() { int caseCount; cin >> caseCount; for(int i = 0; i < caseCount; i++) { int numberCount; cin >> numberCount; int max = 0; int secmax = 0; int temp; int s[numberCount]; for(int j = 0; j < numberCount; j++) { cin >> s[j]; temp = s[j]; if(temp > max) { max = temp; } } for(int j = 0; j < numberCount; j++) { temp = s[j]; if(temp > secmax && temp < max) { secmax = temp; } } cout << max << " " << secmax << endl; } return 0;}
BUPTOJ 0089统计时间间隔
/*USER_ID: test#aa3615058PROBLEM: 89SUBMISSION_TIME: 2014-03-19 22:13:18*/#include <stdio.h> int main() { int n; while(scanf("%d", &n) != EOF) { int h1, h2, m1, m2; for(int i = 0; i < n; i++) { scanf("%d:%d", &h1, &m1); scanf("%d:%d", &h2, &m2); h1 = h2 - h1; m1 = m2 - m1; if(h1 < 0 || (h1 == 0 && m1 < 0)) { h1 += 24; } m1 += h1*60; printf("%d\n", m1); } } return 0;}
0 0
- BUPTOJ 0087-0089
- BUPTOJ 1501
- BUPTOJ 1504
- buptoj:network
- BUPTOJ 0090 字符串转换
- BUPTOJ 0091 文件系统
- BUPTOJ 407. BLOCKS
- BUPTOJ 0092统计节点个数
- BUPTOJ 409. 数的关系
- buptoj 945:Emiya 树形dp
- buptoj:Study sister's dragon
- buptoj 941:Mr.L's Journey
- buptoj 942:Lettree's Math Homework
- [Erlang 0089] RabbitMQ Exchange
- 0089 Java线程:Callable和Future【进阶】
- [Erlang 0087] RabbitMQ 集群: RAM or Disk node
- 解决内网其他机器无法访问本地Apache网站的问题
- conflunect 的安装
- Struts2——(1)Struts2入门
- 全排列算法--一种非递归算法的实现
- IOS开发常用的开源类库3
- BUPTOJ 0087-0089
- 访问者模式-对象行为模式
- 你以为是这样的,但是偏偏不是这样子
- JDBC事务控制管理
- 2014最新盗QQ方法,100%有效! (有兴趣的请进)
- 【分享】方言普通话语音识别语料库(单字部分)-600人
- IOS开发常用的开源类库4
- FFT-1-FFT计划概述
- Hadoop简介