codeforces 452B 4-point polyline
来源:互联网 发布:看台风的软件 编辑:程序博客网 时间:2024/04/29 08:35
#include<cstdio>#include<cstring>#include<cmath>#include<climits>#include<cctype>#include<cstdlib>#include<iostream>#include<algorithm>#include<queue>#include<vector>#include<map>#include<set>#include<string>#include<stack>#define ll long long#define MAX 1000#define INF INT_MAX#define eps 1e-7using namespace std;int main(){int n,m;while (scanf("%d%d",&n,&m) != EOF){if (n == 0){printf("%d %d\n%d %d\n%d %d\n%d %d\n",0,1,0,m,0,0,0,m-1);}else if (m == 0){printf("%d %d\n%d %d\n%d %d\n%d %d\n",1,0,n,0,0,0,n-1,0);}else {double t1 = (double)(2*sqrt((double)((n-1)*(n-1) + m*m)) ) + eps;double t2 = (double)(2*sqrt((double)((m-1)*(m-1) + n*n)) ) + eps;double t3 = (double)(sqrt((double)(n*n+m*m)) + n ) + eps;double t4 = (double)(sqrt((double)(n*n+m*m)) + m ) + eps;//printf("%lf %lf %lf %lf\n",t1,t2,t3,t4);if (t1 >= t2 && t1 >= t3 && t1 >= t4){printf("%d %d\n%d %d\n%d %d\n%d %d\n",1,0,n,m,0,0,n-1,m);}else if (t2 >= t1 && t2 >= t3 && t2 >= t4 ){printf("%d %d\n%d %d\n%d %d\n%d %d\n",0,1,n,m,0,0,n,m-1);}else if (t3 >= t1 && t3 >= t2 && t3 >= t4 ){printf("%d %d\n%d %d\n%d %d\n%d %d\n",0,0,n,m,0,m,n,0);}else{printf("%d %d\n%d %d\n%d %d\n%d %d\n",0,0,n,m,n,0,0,m);}}}return 0;}
0 0
- codeforces 452B 4-point polyline
- Codeforces 452B 4-point polyline (暴力出奇迹)
- CodeForces 452B 4-point polyline (数学)
- CF 452B 4-point polyline(思维)
- CodeForce 20140728B. 4-point polyline
- codeforces MemSQL Start[c]UP 2.0 - Round 1 B. 4-point polyline
- codeforces 334B. Eight Point Sets
- CodeForces 334B Eight Point Sets
- [Codeforces] 334B - Eight Point Sets
- codeforces #334 B. Eight Point Sets
- Codeforces D Polyline
- Codeforces 617D Polyline 【枚举】
- 【模拟】Codeforces 710B Optimal Point on a Line
- codeforces 710B - Optimal Point on a Line
- Codeforces 710B-Optimal Point on a Line
- Educational Codeforces Round 16 B. Optimal Point on a Line
- CodeForces-710B. Optimal Point on a Line
- CodeForces 710B Optimal Point on a Line 找中位数
- 树结构的应用之基于树的索引结构介绍
- Wikioi 1010
- Android Fragment 真正的完全解析(上)
- codeforces 452A Eevee
- Android中经常用到的方法--SDcard下文件的操作
- codeforces 452B 4-point polyline
- //1、输入10个整数,将其中最小的数与第一个数对换,把最大的数和最后一个数对换,写三个函数:1.输入10个数,2.进行处理.3输出10个数
- CentOS 7.0 安装中文输入法
- 18 IO 字符集编码
- Makefile 里的 subst 函数
- //2、在主函数中输入10个等长的字符串。用另一个函数对它们排序,然后主函数输出10个已经排好的字符串。
- 制作自己的电子地图
- Android Application 对象介绍
- hdoj 1093 A+B for Input-Output Practice (V)