poj 1450 水题
来源:互联网 发布:人工智能电影优酷 编辑:程序博客网 时间:2024/06/06 13:15
给你n*m的网格,求把每个点都遍历一遍最后回到起点,最短距离,直线距离为1,斜线距离为根号2.
当n*m为偶数时,会发现只要走n*m长就能到达起点了。
当n*m为奇数时,最后一步走个斜线才能到达起点。
#include<stdio.h>int cas,n,m;int main(){scanf("%d",&cas);for(int i=1;i<=cas;i++){printf("Scenario #%d:\n",i);scanf("%d%d",&n,&m);if(n*m%2){printf("%.2lf\n\n",1.0*n*m+0.41);}else printf("%.2lf\n\n",1.0*n*m);}return 0;}
- poj 1450 水题
- poj 1450
- POJ-1450
- poj水题
- POJ 水题
- POJ 水题
- poj水题
- poj 水题
- poj 水题
- POJ水题
- poj水题
- poj 水题
- POJ水题
- POJ水题
- poj 1450 Gridland
- POJ 1450 最短距离
- poj 1450 Gridland
- POJ 1450 Gridland
- 风尘中,忘了捡拾那日女子留下的胭脂
- LaTeX 如何取消自动断字
- framework按键处理流程
- 搜狗笔试题(请高手们提供牛逼答案)
- 图片的异步加载
- poj 1450 水题
- hdu4283 You Are the One
- 逆波兰式
- [开发学习]之JSON
- 腾讯2013校园招聘笔试题
- Ubuntu 12.04 - 修改环境变量导致无法登录系统
- baseAdapter
- 羌笛声声胡笳怨,此心长寄天涯远
- Mesa 3D