这个题也是好早以前就看了,一直没怎么看懂。
其实好水滴说。
给你一个大井,还有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;
}