#10402: C解法(提供參考)


dddd1597 (johnson0331)


#include<stdio.h>

 

int main()

{

    int cookie, chocolate, cake;

   while(scanf("%d %d %d",&cookie,&chocolate,&cake)!=EOF){

      if(cookie>=10 && cake>=2){

         if((cookie/10)>=(cake/2)) chocolate=chocolate+(cake/2);

         else chocolate+=(cookie/10); 

}

      printf("%d 個餅乾,%d 盒巧克力,%d 個蛋糕。\n",cookie,chocolate,cake);

}

    

    return 0;

}