#include<stdio.h> int main() { int t; double a,s; scanf("%d",&t); while(t--) { s=0; for(int i=0;i<12;i++) { scanf("%lf",&a); s+=a; } //1.注意案例的输出格式 //2.rounded to the nearest penny int ss=s/12.0+0.005; printf("$%d",ss); int yi,er,shu; shu=(s/12.0+0.005)*100; yi=shu%100/10;er=shu%10; if(yi!=0||er!=0) { printf("."); if(yi!=0&&er==0) printf("%d",yi); else printf("%d%d",yi,er); } puts(""); } return 0; }
HDU 4493 Tutor(精度处理)
时间: 2024-10-09 22:35:16