URAL 1572. Yekaterinozavodsk Great Well(继续贴水题~)
2011-09-13 20:55
351 查看
这个题也是好早以前就看了,一直没怎么看懂。
其实好水滴说。
给你一个大井,还有N个井盖,问你能放进这个大井里的井盖的数目。
井和井盖的形状有三种,圆,正方形,正三角形。
井盖可以旋转,比如三角形放到正方形里,可以画出三角形的高一定是最短的那条边,正方形的对角线是最长的边,高如果小于对角线,那么就能放进去啦。
水题一个~
其实好水滴说。
给你一个大井,还有N个井盖,问你能放进这个大井里的井盖的数目。
井和井盖的形状有三种,圆,正方形,正三角形。
井盖可以旋转,比如三角形放到正方形里,可以画出三角形的高一定是最短的那条边,正方形的对角线是最长的边,高如果小于对角线,那么就能放进去啦。
水题一个~
#include <set> #include <map> #include <queue> #include <stack> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <limits.h> #include <string.h> #include <string> #include <algorithm> #define MID(x,y) ( ( x + y ) >> 1 ) #define L(x) ( x << 1 ) #define R(x) ( x << 1 | 1 ) #define FOR(i,s,t) for(int i=s; i<t; i++) #define BUG puts("here!!!") #define STOP system("pause") using namespace std; double min_len(int type, double l) { switch( type ) { case 1 : return l * 2; case 2 : return l; case 3 : return l * sqrt(3.0) / 2; } } double max_len(int type, double l) { switch( type ) { case 1 : return l * 2; case 2 : return l * sqrt(2.0); case 3 : return l; } } int main() { int n, type; double l, ll; while( ~scanf("%d%lf", &type, &l) ) { int sum = 0; l = max_len(type, l); scanf("%d", &n); while( n-- ) { scanf("%d%lf", &type, &ll); ll = min_len(type, ll); if( ll <= l ) sum++; } printf("%d\n", sum); } return 0; }
相关文章推荐
- URAL 1572 Yekaterinozavodsk Great Well(简单几何)
- URAL 1572. Yekaterinozavodsk Great Well(数学啊)
- ural 1572 Yekaterinozavodsk Great Well
- URAL 1779 F - The Great Team 构造
- 简单图论 ural 1779. The Great Team
- 410. The frog in the well knows nothing of the great ocean. 坐井观天
- ural 1779. The Great Team
- URAL 1779. The Great Team
- URAL 1779 The Great Team 构造题
- toj1572_Yekaterinozavodsk Great Well
- 一道数学平面几何题:1572. Yekaterinozavodsk Great Well
- 继续更新笔记
- The Great Pan——模拟
- 启动页上点击广告跳转,退出广告页后返回继续启动的实现方法
- 一个等待Winexec执行完成后再继续执行后面代码的函数
- HDU 4006 The kth great number (基本算法-水题)
- ZOJ3947-Very Happy Great BG
- 好迷惘.不知道继续java,还有生存空间吗?
- URAL 1023 Buttons(巴什博弈水题)
- CentOS6出现倒计时后不再继续启动