HDU1006
2016-07-14 11:27
211 查看
我只是想存一下这些水题的代码
#include<iostream> #include<algorithm> #include<cmath> #include<iomanip> using namespace std; int main() { int n; while (cin >> n) { if (n == -1)break; int sum = 0; for (int a = 0;a < 12;a++) { for (int b = 0;b < 60;b++) { for (int c = 0;c < 60;c++) { long double x = abs(30 * a * 120 - 55 * b * 12 - 11 * c); long double yi = min(x, 360 * 120 - x); x = abs(6 * b * 120 - 59 * c * 12); long double er = min(x, 360 * 120 - x); x = abs(30 * a * 120 + 5 * b * 12 - 719 * c); long double san = min(x, 360 * 120 - x); if (yi >= n * 120 && er >= n * 120 && san >= n * 120)sum++; } } } printf("%.3f\n", (100.0*sum) / (12 * 3600)); } return 0; }
相关文章推荐
- Android提高第九篇之SQLite分页表格
- POJ 3243 Clever Y
- 解决 The mysql extension is deprecated and will be r
- Socket通信
- 机器学习中的范数规则化之(一)L0、L1与L2范数
- 欢迎使用CSDN-markdown编辑器
- phpMyAdmin提示:配置文件权限错误,无法写入!解决方法
- [LeetCode]371. Sum of Two Integers
- 【数据结构】链队列
- swift NSDate
- 使用Gitlab一键安装包后的备份恢复与迁移
- [Java]排序算法专题(更新未完)
- 解决linux scp、ssh 登陆远程服务器连接速度慢
- 输入框特殊字符过滤
- Eclipse下使用findbugs进行代码审查
- 1050. String Subtraction (20)
- 剑指offer(63)-机器人的运动范围
- idea svn 的使用----转载,挺好的
- Intellij IDEA svn的使用记录
- CountDownLatch 和 CyclicBarrier