andy6804tw
10/12/2016 - 2:07 AM

http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=30748

#include<stdio.h>    
int main(){    
    int tim[4],i,min,count=0,total=0;    
    for(i=0;i<4;i++)scanf("%d",&tim[i]);    
    min=(tim[2]*60+tim[3])-(tim[0]*60+tim[1]);    
    while(min>=30){    
        min-=30;    
        ++count;    
        if(count<=4)total+=30;    
        else if(count<=8&&count>4)total+=40;    
        else total+=60;    
    }    
    printf("%d\n",total);    
return 0;    
}