zoj1037
2012-03-03 17:14
375 查看
这道题把规律找出来后难度还行。主要分width*length的奇偶。当为偶数时,可以一步不重复地走完,当为奇数时,就要用平方根了。
#include<stdio.h> #include<math.h> int main() { float num; int n; int width,length; int count=0; scanf("%d",&n); while(n) { scanf("%d%d",&length,&width); if((width*length)%2) { num=width*length*1.0-1.0+sqrt(2); } else { num=width*length*1.0; } count++; n--; printf("Scenario #%d:\n",count); printf("%.2f\n\n",num); } return 0; }
相关文章推荐
- ZOJ 1037
- ZOJ 1037 A - Gridland
- [Icpc] zoj 1037 Gridland (water C++ / Java)
- ZOJ 1037 Gridland
- zoj 1037 Gridland
- zoj 1037 Gridland
- [Icpc] zoj 1037 Gridland (water C++ / Java)
- ZOJ 1037 Gridland
- ZOJ_1037_Gridland
- Python--ZOJ1037
- ZOJ Problem Set - 1037 Gridland
- 【简单】ZOJ1037 Gridland
- zoj 1037
- ZOJ1037-Gridland
- zoj 1037 Gridland
- ZOJ 1037 && HDU 1046 Gridland (找规律)
- ACM-ZOJ 1037
- ZOJ--1037:Gridland
- ZOJ-1037-Gridland
- zoj 1037 gridland