#include<math.h> #include<stdio.h> int main() { int teams=0; int gold=0,siliver=0,cu=0,t; scanf("%d",&teams); gold= ceil(0.1*teams); t=floor(0.1*teams); gold=gold-t; //printf("gold %d %d %d\n", ceil(1/6.0*teams),floor(1/6.0*teams),gold); siliver=ceil(0.2*teams); t=floor(0.2*teams); siliver=siliver-t; // printf("siliver %d %d\n", ceil(1/6.0*teams),floor(1/6.0*teams)); cu= ceil(0.3*teams); t=floor(0.3*teams); cu=cu-t; // printf("cu %d %d\n", ceil(1/6.0*teams),floor(1/6.0*teams)); printf("%d %d %d",gold,siliver+gold,cu+gold+siliver); return 0; }
关键理解队伍的关系。前后如果的奖牌的队相同,但是有可能已经增加了新队,我们要算的就是这些增加的新队。