[ZJd669][UVA11677] Alarm Clock
題目:
http://zerojudge.tw/ShowProblem?problemid=d669
=====================================================================
#include<cstdio>
int main(void)
{
int h1,m1,h2,m2;
while(scanf("%d%d%d%d",&h1,&m1,&h2,&m2)!=EOF)
{
int z=0;
if(h1==0 && m1==0 && h2==0 && m2==0)break;
if(h2<h1 || h1==h2 && m2<m1)
h2+=24;
z=(h2-h1)*60-m1+m2;
printf("%d\n",z);
}
return 0;
}
http://zerojudge.tw/ShowProblem?problemid=d669
=====================================================================
#include<cstdio>
int main(void)
{
int h1,m1,h2,m2;
while(scanf("%d%d%d%d",&h1,&m1,&h2,&m2)!=EOF)
{
int z=0;
if(h1==0 && m1==0 && h2==0 && m2==0)break;
if(h2<h1 || h1==h2 && m2<m1)
h2+=24;
z=(h2-h1)*60-m1+m2;
printf("%d\n",z);
}
return 0;
}
留言
張貼留言