2009-02-19 22:06:06來源不明
章魚教學網站-97學年度程設馬拉松賽 On Sale
double有測不準原理 哈,此時暴力就現身了
/***********************************************************/
- #include<stdio.h>
- #include<stdlib.h>
- main()
- {
- int a,b;
- while(scanf("%d.%d",&a,&b)==2)
- {
- int c=a*100+b;
- int y;
- if(c<=10000)
- {
- y=c*9/10;
- a=y/100+8;
- b=y%100;
- }
- else if(c>10000&&c<=50000)
- {
- y=c*4/5;
- a=y/100;
- b=y%100;
- }
- else
- {
- y=c*3/5;
- a=y/100;
- b=y%100;
- }
- if(b>=10)
- printf("$%d.%d\n",a,b);
- else
- printf("$%d.0%d\n",a,b);
- }
- return 0;
- }