2022-03-17 18:44:41 +00:00
|
|
|
#include<stdio.h>
|
|
|
|
#include<stdlib.h>
|
|
|
|
#include<string.h>
|
|
|
|
#include<math.h>
|
|
|
|
#define SIZE 30
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
char pol[SIZE];
|
2022-03-17 20:49:06 +00:00
|
|
|
memset(pol,'\0',SIZE);
|
2022-03-17 22:03:17 +00:00
|
|
|
//pol[SIZE]='\0';
|
2022-03-17 18:44:41 +00:00
|
|
|
|
|
|
|
int ch=0;
|
|
|
|
|
|
|
|
for(int idx=0;1;idx++ ){
|
|
|
|
ch=getchar();
|
|
|
|
if(ch==EOF||ch==' ')break;
|
|
|
|
pol[idx]=ch;
|
|
|
|
}
|
|
|
|
|
2022-03-17 22:03:17 +00:00
|
|
|
/*for(int i=0; i<strlen(pol);i++){
|
|
|
|
if(pol[i]=='\n')printf("||");
|
|
|
|
else printf("%c",pol[i]);
|
|
|
|
}*/
|
|
|
|
|
2022-03-17 20:49:06 +00:00
|
|
|
|
2022-03-17 22:03:17 +00:00
|
|
|
int koef=-1;
|
2022-03-17 20:49:06 +00:00
|
|
|
for(int i=0;i<strlen(pol);i++){
|
2022-03-17 22:03:17 +00:00
|
|
|
if(pol[i]=='\n')continue;
|
|
|
|
for(int i2=0;pol[i]!='\n';i++,i2++);
|
2022-03-17 20:49:06 +00:00
|
|
|
koef++;
|
|
|
|
}
|
2022-03-17 18:44:41 +00:00
|
|
|
|
2022-03-17 22:03:17 +00:00
|
|
|
long double x=0;
|
2022-03-17 18:44:41 +00:00
|
|
|
char *end = NULL;
|
|
|
|
char *start = pol;
|
|
|
|
x=strtof(start,&end);
|
2022-03-17 22:03:17 +00:00
|
|
|
x=(round(x*100))/100;
|
2022-03-17 18:44:41 +00:00
|
|
|
start=end;
|
|
|
|
|
2022-03-17 22:03:17 +00:00
|
|
|
long double num=0;
|
2022-03-17 18:44:41 +00:00
|
|
|
for(int i=0;i<koef;i++){
|
2022-03-17 22:03:17 +00:00
|
|
|
long double p=1, n=0;
|
2022-03-17 18:44:41 +00:00
|
|
|
n=strtof(start,&end);
|
2022-03-17 22:00:47 +00:00
|
|
|
start=end;
|
2022-03-17 22:03:17 +00:00
|
|
|
n=(round(n*100))/100;
|
2022-03-17 18:44:41 +00:00
|
|
|
|
2022-03-17 22:03:17 +00:00
|
|
|
p=pow(x,(koef-i)-1);
|
2022-03-17 18:44:41 +00:00
|
|
|
|
|
|
|
num+=p*n;
|
|
|
|
}
|
2022-03-17 22:03:32 +00:00
|
|
|
num=round(num*100)/100;
|
2022-03-17 18:44:41 +00:00
|
|
|
|
2022-03-17 22:03:17 +00:00
|
|
|
printf("%.2Lf\n", num);
|
2022-03-17 18:44:41 +00:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2022-03-17 22:03:17 +00:00
|
|
|
|