?? 1020.cpp
字號:
#include <iostream>#include <math.h>using namespace std;const int maxN = 100;const double PI = 3.1415926;int n;double ans,r;struct point{ double x,y; };point pArr[ maxN + 1 ];double dis( point a, point b ){ return sqrt( (a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y) );}void readIn(){ int i; cin >> n >> r; for( i = 1; i <= n; i++ ) { cin >> pArr[i].x >> pArr[i].y; }}void work(){ int i; for( i = 1; i < n; i++ ) ans += dis( pArr[i],pArr[i+1] ); ans += dis( pArr[i],pArr[1] ); ans += 2*PI*r;}int main(){// freopen("1020.in","r",stdin); readIn(); work(); cout.setf(ios::fixed); cout.precision(2); cout << ans << endl; return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -