【基础训练】HDOJ2033 && HDOJ2034
来源:互联网 发布:中国企业跨国并购数据 编辑:程序博客网 时间:2024/04/29 10:48
★本题目考察代码熟练度,没有用到数据结构和算法
★代码实现
#include<stdio.h>int main(){ int n; int AH,AM,AS,BH,BM,BS,SH,SM,SS; scanf("%d",&n); while(n --) { SH = SM = SS = 0; scanf("%d %d %d %d %d %d",&AH,&AM,&AS,&BH,&BM,&BS); SS = AS + BS; if(SS >= 60) { SS -= 60; SM += 1; } SM = SM + AM + BM; if(SM >= 60) { SM -= 60; SH += 1; } SH = SH + AH + BH; printf("%d %d %d\n",SH,SM,SS); } return 0; }
★本题比较坑,输出格式搞了好久
★代码实现
#include <stdio.h>int main(){ int m,n,i,j,flag,count,temp; int a[250],b[105]; while(scanf("%d %d",&m,&n)!=EOF && (m!=0 || n!=0)) { count = 0; for(i = 0;i < m+n;i++) scanf("%d",&a[i]); for(i = 0;i < m;i++) { flag = 0; for(j = m;j < m+n;j++) { if(a[i]==a[j]) { flag = 1; break; } } if(flag == 0) { b[count] = a[i]; count++; } } for(i = 0;i < count;i++) { for(j = 0;j < count-i-1;j++) { if(b[j] > b[j+1]) { temp = b[j]; b[j] = b[j+1]; b[j+1] = temp; } } } if(count == 0) printf("NULL\n"); else { for(i = 0;i < count;i++) printf("%d ",b[i]); printf("\n"); } } return 0; }
0 0
- 【基础训练】HDOJ2033 && HDOJ2034
- hdoj2034
- hdoj2034
- HDOJ2034
- 基础训练
- 基础训练
- 2014-12-11 hdoj2033
- hdoj2033人见人爱A+B
- hdoj2034 人见人爱A-B
- 2014-12-11 hdoj2034
- hdoj2034人见人爱A-B
- acm 基础训练
- mysql基础训练
- xml基础训练
- 基础训练 回形取数
- 蓝桥杯 基础训练
- 8.29 基础训练
- UJN_基础训练
- 薛峰:可执行洞察:充分利用不同的系统
- Linux下升级JAVA的一个小方法
- jstl 开发总结
- 第一次发文章
- C++ ofstream和ifstream详细用法
- 【基础训练】HDOJ2033 && HDOJ2034
- java入门第一课
- Node.js 安装配置
- Linux X86下的TLB机制分析
- B(B-)树, B+树,B*树,红黑树
- 我的C语言程序
- 【Android】状态栏通知Notification
- ubuntu14.04上创建能够给android手机(AP模式)使用的热点
- DDMS 中访问需要root权限文件的方法