【POJ1939】:Diplomatic License
来源:互联网 发布:郭艾伦体测数据 编辑:程序博客网 时间:2024/05/20 08:42
题意
给出实例,求各个相邻两点的中点,注意点是x,y ,然后最后一个点是和第一个点做平均分配的
思路
如题意所说,稍微看下代码就明白咋回事了
注意的是必须要是保留六位的格式~
代码
#include <iostream>#include <iomanip>#define F fixed#define S setprecision(6)#define max 1000using namespace std;double x[max],y[max];int main(){ int n,i; double pos1,pos2; while(cin>>n){ cout<<n; for(i=0;i<n;i++){ cin>>x[i]>>y[i]; } for(i=0;i<n-1;i++){ pos1 =(x[i]+x[i+1])/2.0; pos2 =(y[i]+y[i+1])/2.0; cout<<" "<<F<<S<<pos1<<F<<S<<" "<<pos2; } pos1 = (x[n-1]+x[0])/2.0; pos2 = (y[n-1]+y[0])/2.0; cout<<" "<<F<<S<<pos1<<" "<<F<<S<<pos2<<endl; } return 0;}
0 0
- 【POJ1939】:Diplomatic License
- 【坑】【水】poj1939 Diplomatic License
- poj 1939 Diplomatic License
- POJ 1939 Diplomatic License G++
- zoj 1973 || poj 1939 Diplomatic License
- POJ 1939 Diplomatic License(求线段中点)
- POJ 1939 Diplomatic License(水~)
- poj1939
- poj1939 water
- poj1939(计算几何)
- License
- License
- license
- license
- OGRE License & FBReader License
- 常用软件License
- MIT LICENSE
- 更换License
- 1045-Access denied for user 'root'@'localhost'(using password:YES)
- 搭建CAS单点登录服务器
- 浅谈工业级物联网项目架构设计及实施
- 临时
- JAVA成长之路
- 【POJ1939】:Diplomatic License
- Java2平台版本
- 如何实现携程动态加载插件中对aapt的改造
- 昂贵的聘礼
- LeetCode----Happy Number
- Java基本数据类型与四个运算
- txt文件导入数据库的utf-8问题
- AndroidStudio中添加第三库文件的方法
- 关于幻读