zoj 3693

#include<stdio.h>
#include<string.h>//进位问题如3.985    应该进位3.99
int main() {
    int n,k,i;
double w,s;
char str[30];
while(scanf("%d%lf%d",&n,&w,&k)!=EOF) {
       i=(n+2)/k;
  n=n+2-i;
  s=n*w/2;
  sprintf(str,"%lf",s);
  i=0;
  while(str[i]!=0&&str[i]!='.')
  i++;
  k=0;
  if(str[i+3]>='5')
  k=1;
  str[i+3]=0;
sscanf(str,"%lf",&s);
printf("%.2f\n",s+0.01*k);
}
return 0;
}
posted @ 2014-03-12 14:51  HYDhyd  阅读(129)  评论(0编辑  收藏  举报