http://acm.timus.ru/problem.aspx?space=1&num=1572
一样是很坑爹的题目。。。原来cover不止可以横着放,还可以竖着放。。。。。
代码:
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
const int N = 110;
int t[N];
double s[N];
int main()
{
int n;
while (scanf("%d%lf", &t[0], &s[0]) != EOF)
{
if (t[0] == 1) s[0] *= 2;
if (t[0] == 2) s[0] *= sqrt(2.0);
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d%lf", &t[i], &s[i]);
for (int i = 1; i <= n; i++)
{
if (t[i] == 1) s[i] *= 2;
if (t[i] == 3) s[i] *= sqrt(3.0) / 2.0;
}
int sum = 0;
for (int i = 1; i <= n; i++)
if (s[i] <= s[0])
sum++;
printf("%d\n", sum);
}
}
本文介绍了一种计算不同形状覆盖物是否能被特定大小的覆盖物完全覆盖的算法。通过调整覆盖物尺寸并进行比较,该算法能够计算出在给定条件下能够被覆盖的覆盖物数量。
586

被折叠的 条评论
为什么被折叠?



