| Show all threads Hide all threads Show all messages Hide all messages |
| I got WA on the test2 | zhuaiyaa | 1030. Titanic | 3 Dec 2010 17:13 | 1 |
Can anyone give me a test?Thanks a lot. |
| Can you help me? | Nike_1 | 1112. Cover | 3 Dec 2010 12:40 | 1 |
My english ability is very poor!So I can't express correctly~I feel very sorry. About this problem,I have tried many data.But I am sorry I can't found that anything is wrong.Next I will give my code,I hope somebody can help me,or give me some hints.Thank you very much~ #include "stdio.h" #include "malloc.h" int main() { int amount,i,j; int **endpoint; int *flag,temp; int max,index = -1; int condition = 0,count = 0; int test = 0; scanf("%d",&amount); // if(amount <= 0 || amount >= 100) // { // return 0; // } endpoint = (int **)malloc(sizeof(int*) * amount); flag = (int *)malloc(sizeof(int) * amount); for( i = 0;i < amount;i ++) { endpoint[i] = (int *)malloc(sizeof(int) * 2); } flag = (int *)malloc(sizeof(int) * amount); for( i = 0;i < amount;i ++ ) { scanf("%d%d",&endpoint[i][0],&endpoint[i][1]); if( endpoint[i][0] == endpoint[i][1] || endpoint[i][0] > 999 || endpoint[i][0] < -999 || endpoint[i][1] > 999 || endpoint[i][1] < -999) { return 0; } flag[i] = 0; if(endpoint[i][0] > endpoint[i][1]) { temp = endpoint[i][0]; endpoint[i][0] = endpoint[i][1]; endpoint[i][1] = temp; } } //排序 for(i = 0; i < amount - 1 ;i ++) { for(j = i + 1;j < amount;j++) { if(endpoint[i][0] > endpoint[j][0]) { temp = endpoint[i][0]; endpoint[i][0] = endpoint[j][0]; endpoint[j][0] = temp; temp = endpoint[i][1]; endpoint[i][1] = endpoint[j][1]; endpoint[j][1] = temp; } } } while(condition != 0 || count == 0 ) { condition = 0; test = 0; for(i = 0;i < amount;i ++) { if(endpoint[i][0] !=0 || endpoint[i][1] != 0) { for(j = 0;j < amount;j ++) { if(endpoint[j][0] !=0 || endpoint[j][1] != 0) { if(endpoint[i][0] > endpoint[j][0] && endpoint[i][0] < endpoint[j][1] ) { flag[i] += 1; } else if(endpoint[i][0] <= endpoint[j][0] && endpoint[i][1] >= endpoint[j][1] ) { if(i != j && ( endpoint[i][0] != 0 || endpoint[j][0] != 0 )) flag[i] += 1; } else { if(endpoint[i][1] > endpoint[j][0] && endpoint[i][1] < endpoint[j][1]) { flag[i] += 1; } } } } } } max = flag[0]; index = 0; condition += flag[0]; flag[0] = 0; for( i = 1 ;i < amount;i ++ ) { condition += flag[i]; if(max < flag[i]) { max = flag[i]; index = i; } flag[i] = 0; } if(index != -1 && condition != 0 ) { endpoint[index][0] = 0; endpoint[index][1] = 0; } count ++; } printf("%d\n",amount - count + 1); for(i = 0 ;i < amount;i ++) { if(endpoint[i][0] != 0 || endpoint[i][1] != 0) { printf("%d %d\n",endpoint[i][0],endpoint[i][1]); } } return 0; } |
| 0.046s. Who's better? (-) | Krayev Alexey (PSU) | 1462. Uncle Scrooge's Gold | 2 Dec 2010 12:17 | 9 |
Please, send me your solution or algorithm!!! my email: xujand000@rambler.ru Edited by author 23.10.2006 19:00 I'm also interested in a c++ solution of this problem, please send to tabledott@gmail.com Simple problem... FFT can be used to solve it, but for what purpose??? |
| some test | hoan | 1302. Delta-wave | 1 Dec 2010 23:47 | 1 |
input: 1 1000000000 1 27 1 29 1 31 74 74747474 output: 63243 9 9 9 17275 GOOD LUCK!!! |
| Why WA#9? | Lucifer | 1227. Rally Championship | 1 Dec 2010 19:49 | 2 |
try this: input: 3 2 12 1 2 10 2 3 5 output: YES if you WA#17 try this: input: 4 3 12 1 2 5 1 3 4 3 4 4 output: YES GOOD LUCK!!! |
| if you have WA#3 swap x and y. | hoan | 1250. Sea Burial | 1 Dec 2010 18:04 | 1 |
|
| 1584 test 3 WA | Seroj RAU | 1083. Factorials!!! | 1 Dec 2010 17:28 | 1 |
3 3 abc def ghi 5 __________ 4 3 baab aaaa baab 0 ___________ 4 4 aaaa abba abba aaaa 0 ________ и.т.д. ВСЁ ВРОДИ ПРАВИЛЬНО НИ КАК НЕ НАЙДУ ОЩИБКУ!!! |
| 1584 WA 3 | Seroj RAU | 1001. Reverse Root | 1 Dec 2010 17:27 | 1 |
3 3 abc def ghi 5 __________ 4 3 baab aaaa baab 0 ___________ 4 4 aaaa abba abba aaaa 0 ________ и.т.д. ВСЁ ВРОДИ ПРАВИЛЬНО НИ КАК НЕ НАЙДУ ОЩИБКУ!!! |
| Why WA in test 2. My code here. Please help me. | nguyenductam | 1055. Combinations | 1 Dec 2010 13:47 | 3 |
#include<stdio.h> #include<conio.h> long int i,j,n,m,aa,bb,cc,lap,k,l; int a[50001],sont; int dem[50001]; long int kq; void InitPrime(); long int Max(long int x,long int y); long int Min(long int x,long int y); void InitDem(); void Test(); int main() { scanf("%ld %ld",&n,&m); aa=Max(n,m); bb=Min(n,m); cc=aa-bb;
InitDem(); InitPrime(); // Test();
lap=Max(bb,cc); i=lap+1; // tinh so nguyen to o tren tu while(i<=aa) { k=0; l=i; while(l!=1) { k++; while((l%a[k])==0) { l=l/a[k]; dem[a[k]]++; } } i++; }
// tinh so nguyen to duoi mau lap=Min(bb,cc); i=2; // tinh so nguyen to o tren tu while(i<=lap) { k=0; l=i; while(l!=1) { k++; while((l%a[k])==0) { l=l/a[k]; dem[a[k]]--; } } i++; }
//dem ket qua kq=0; i=2; while(i<=aa) { if(dem[i]!=0) kq+=dem[i]; i++; } printf("%ld",kq);
getch(); return 0; } void InitDem() { i=1; while(i<=aa) { dem[i]=0; i++; } } long int Max(long int x,long int y) { if(x<=y) return y; return x; } long int Min(long int x,long int y) { if(x<=y) return x; return y; } void InitPrime() { int flag; long int x; a[1]=2; a[2]=3; a[3]=5; a[4]=7; i=4; x=11; while(x<aa+1) { j=2; flag=1; while(j*j<x) { if(x%j==0) { flag=0; break; } j++; } if(flag==1) { a[++i]=x; } x+=2; } sont=i; } void Test() { for(i=1;i<=sont;i++) printf("%d\n",a[i]); // getch(); } Hi, Try these test cases: Test Cases 200000 40000 9011 100000 35000 6109 123456 12345 3892 987654 98765 25861 560011 12000 5255 340999 43560 11372 235000 34001 8723 89340 10000 3123 98112 23 35 4567 456 212 Varun Hi, Try these test cases: Test Cases 200000 40000 9011 100000 35000 6109 123456 12345 3892 987654 98765 25861 560011 12000 5255 340999 43560 11372 235000 34001 8723 89340 10000 3123 98112 23 35 4567 456 212 Varun N M between 1 & 50 000 |
| <TOP SECRET> 15 лет колоний и лагерей будет | And IV | 1055. Combinations | 1 Dec 2010 11:13 | 3 |
#include <iostream> using namespace std; int i,o,n,m,k,nm[50001],n_m[50001],n_n[50001],c; bool bb[50001]; int main() { cin>>n>>m; bb[1]=true; for(i=2;i<=n;i++) if (!bb[i]) for(o=2*i;o<=n;o+=i)bb[o]=true; for(i=2;i<=n;i++) if (bb[i]) { k=i; for(o=2;o<=i;o++) if (!bb[o]) { while(k%o==0) { nm[o]++; k/=o; } if (k==1) break; } } else { nm[i]++; } for(i=2;i<=m;i++) if (bb[i]) { k=i; for(o=2;o<=i;o++) if (!bb[o]) { while(k%o==0) { n_m[o]++; k/=o; } if (k==1) break; } } else { n_m[i]++; } for(i=2;i<=n-m;i++) if (bb[i]) { k=i; for(o=2;o<=i;o++) if (!bb[o]) { while(k%o==0) { n_n[o]++; k/=o; } if (k==1) break; } } else { n_n[i]++; } for(i=2;i<=n;i++) { nm[i]-=n_n[i]+n_m[i]; if (nm[i]>0) c++; } cout<<c; return 0; } |
| WA#3 | hoan | 1245. Pictures | 30 Nov 2010 22:16 | 1 |
WA#3 hoan 30 Nov 2010 22:16 in this test ther is only one pictures need, like this: input: 1 100 0 0 output: 40000 GOOD LUCK!!! |
| Here some tests... They saved me... | KIEV_lyceum_№145 (Grinenko,Kalugin,Ryjouk) | 1245. Pictures | 30 Nov 2010 22:15 | 2 |
>2 0 0 8 2 2 6 My output: 10000 3 745 852 22 49 235 549 856 460 11 My output: 3412016 |
| Что не так?( Why WA test 2) | fsb4000 | 1048. Superlong Sums | 30 Nov 2010 20:05 | 1 |
#include<iostream> #include<cstdlib> #include<vector> #include<string> using namespace std; typedef vector<long> lnum; const long base=1000*1000*1000; void print(lnum a){ printf ("%d", a.empty() ? 0 : a.back()); for (int i=(int)a.size()-2; i>=0; --i) printf ("%09d", a[i]); } void a_plus_b_a(lnum &a, lnum b){ long carry = 0; for (size_t i=0; i<max(a.size(),b.size()) || carry; ++i) { if (i == a.size()) { a.push_back (0); } a[i] += carry + (i < b.size() ? b[i] : 0); carry = a[i] >= base; if (carry) { a[i] -= base; } } } lnum string_to_Super_long_number(string s){ lnum a; for (int i=(int)s.length(); i>0; i-=9) { if (i < 9) { a.push_back (atoi (s.substr (0, i).c_str())); } else { a.push_back (atoi (s.substr (i-9, 9).c_str())); } } while (a.size() > 1 && a.back() == 0){ a.pop_back(); } return a; } int main(void){ lnum a,b; long i; long m; char c; string s1="",s2=""; cin>>m; for(i=0;i<m;i++) { cin>>c; s1=s1+c; cin>>c; s2=s2+c; } a=string_to_Super_long_number(s1); b=string_to_Super_long_number(s2); a_plus_b_a(a,b); print(a); cout<<endl; system("pause"); return 0; } |
| WA24 | TheDreamCatcher | 1354. Palindrome. Again Palindrome | 30 Nov 2010 18:53 | 1 |
WA24 TheDreamCatcher 30 Nov 2010 18:53 I used in my program char a[10000]; cin>>a; after I used char a[10001]; cin>>a; and got AC |
| WA #2 | Pavel Kovalenko | 1303. Minimal Coverage | 30 Nov 2010 16:54 | 2 |
WA #2 Pavel Kovalenko 30 Nov 2010 16:37 I really do not understand where the error occurred. For most useful i shift all coordinates on 1 to right. Here is my code: http://pastebin.com/LpZfCwYgI find my error. I misunderstood statement. I thought that I cover the cell matrix 1xM. |
| WA #3 Again! | Nurbek_[KTMU MANAS] | 1603. Erudite | 30 Nov 2010 07:51 | 4 |
Please explain me where is tricky? If you don't want say tricky, give some tests. I use backtracking. Edited by author 06.03.2008 16:22 Edited by author 06.03.2008 16:23 test 3 contains "\n" strings How? I can't understand. Please explain better. test 3 contains "\n" strings This is impossible. In the next N strings follow N words with length between 1 and 16 |
| Please look here... wa3 | Crash_access_violation | 1603. Erudite | 30 Nov 2010 07:49 | 8 |
thanks... I got AC! Edited by author 12.03.2008 04:00 try test with '\n' string: abra adac babr arca 3 abracadabra ababaab ababaaba And how test is right? What a test #3? I know how to solve this task, but test #3... When I used gets() I had wa3 and this test help me to change gets() to scanf(...)) and after that I got ac Test#3 has two words are exactly the same Edited by author 30.11.2010 07:48 Edited by author 30.11.2010 07:48 try test with '\n' string: abra adac babr arca 3 abracadabra ababaab ababaaba This is impossible. In the next N strings follow N words with length between 1 and 16 |
| TO ADMINS | hoan | 1244. Gentlemen | 29 Nov 2010 23:28 | 1 |
the judje calcute the memory wrong. my Ac code have this line:
char dp[100+5][100000+5]; as a global array in C++. it has about 10000Kb, but the judge calcute memory about 5000Kb. sorry for my poor english. Edited by author 29.11.2010 23:28 |
| Time Limit Test for You | vetas | 1254. Die Hard | 29 Nov 2010 21:44 | 6 |
75 75 1000 1.23 .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.# ..........................................................................# .########################################################################## ..........................................................................# #########################################################################.. 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 1 1 75 75 My program works for about 58 seconds on this test (I'm using Deikstra over Heap) |
| please help, what's wrong on this? | Shokhrukh | 1020. Rope | 29 Nov 2010 19:33 | 1 |
#include <iostream> #include <math.h> #include <iomanip> using namespace std; void main() { double x[99],y[99],r,n,dlina[99]; cin >> n >> r; double P=2*3.14*r; for (int i=0; i<=n-1; i++) { cin >> x[i] >> y[i]; } for (int j=0; j<=n-1; j++) { if (j!=(n-1)) { dlina[j]=sqrt((x[j]-x[j+1])*(x[j]-x[j+1])+(y[j]-y[j+1])*(y[j]-y[j+1])); P+=dlina[j]; } else { dlina[j]=sqrt((x[j]-x[0])*(x[j]-x[0])+(y[j]-y[0])*(y[j]-y[0])); P+=dlina[j]; } } cout << setprecision(2) << setiosflags (ios::showpoint | ios::fixed) << P;
} |