UVa 11044 - Searching for Nessy
2014-04-19 16:31
537 查看
传送门UVa 11044 - Searching for Nessy
这题够水...
因为要忽略掉边框, 把给出的行列各减去二就可以了. 然后各除以三, 向上取整...
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
//freopen("input.txt", "r", stdin);
int T;
double row, colomn;
double rnum, colnum;
scanf("%d", &T);
while (T--)
{
scanf("%lf%lf", &row, &colomn);
row -= 2;
colomn -= 2;
rnum = ceil(row / 3);
colnum = ceil(colomn / 3);
printf("%d\n", (int)(rnum * colnum + 0.5));
}
return 0;
}
这题够水...
因为要忽略掉边框, 把给出的行列各减去二就可以了. 然后各除以三, 向上取整...
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
//freopen("input.txt", "r", stdin);
int T;
double row, colomn;
double rnum, colnum;
scanf("%d", &T);
while (T--)
{
scanf("%lf%lf", &row, &colomn);
row -= 2;
colomn -= 2;
rnum = ceil(row / 3);
colnum = ceil(colomn / 3);
printf("%d\n", (int)(rnum * colnum + 0.5));
}
return 0;
}
相关文章推荐
- 简单的四则运算
- 数的奇偶性
- ACM网址
- 1272 小希的迷宫
- 1272 小希的迷宫
- hdu 1250 大数相加并用数组储存
- 1.10055 - Hashmat the brave warrior
- 2.10071 - Back to High School Physics
- 3.458 - The Decoder
- 4.694 - The Collatz Sequence
- 6.494 - Kindergarten Counting Game
- 7.490 - Rotating Sentences
- 8.414 - Machined Surfaces
- 9.488 - Triangle Wave
- A.457 - Linear Cellular Automata
- B.489 - Hangman Judge
- C.445 - Marvelous Mazes
- 1.10494 - If We Were a Child Again
- 2.424 - Integer Inquiry
- 3.10250 - The Other Two Trees