hdu2180 时钟
来源:互联网 发布:如何减腓肠肌 知乎 编辑:程序博客网 时间:2024/05/01 17:12
关键:
思考分针,看看分针可以在这个时间段内循环多少圈,每循环一圈就是相遇一次。
不过要仔细计算,否则会答案错误的
http://acm.hdu.edu.cn/showproblem.php?pid=2180
代码:
#include <stdio.h>int main(){ int a,b,s,t; int res1, res2, res; while(1) { scanf("%d%d%d%d", &a, &b, &s, &t); if(a == 0 && b == 0 && s == 0 && t == 0) break; a = a%12; s = s%12; res1 = (a*60+b)*11;//这里要牢记,11 res2 = (s*60+t)*11; if(res2 < res1) res2 += 720*11; res = res2/720 - res1/720;//可以走多少圈,和已经走多少圈相减 if(res1 == 0) //00:00出发的时候,加上出发时相遇 res++; printf("%d\n", res); } return 0;}
0 0
- hdu2180 时钟
- hdu2180
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 时钟
- 开源夏令营Memcached哈希性能优化(二)
- Hibernate的检索方式
- Ubuntu下VMware无法保存配置文件问题
- unity 我的第一个项目总结(进行中)
- Linux原子操作 (Linux atomic operations)
- hdu2180 时钟
- opencv支持多种流行视频格式文件的读取
- 开始
- siegen程学android应用开发重新开始篇——改变之道。
- 自己写的一个Epoll实例
- Keil MDK的FCARM报错的记录
- cocos2d-x Action 动画
- spring framework源码下载并导入eclipse
- OpenGLES demo - 12. 材质贴图 Texture Mapping