Problem number: 11677
Problem name: Alarm Clock
int main()
{
int h,h1,m1,h2,m2,m;
while(scanf("%d%d%d%d",&h1,&m1,&h2,&m2)==4){
if(h1==0&&m1==0&&h2==0&&m2==0)
break;
if(h1==0)
h1=24;
if(h2==0)
h2=24;
if(h1==h2&&m1>m2){
m=1440+(60-m1)-(60-m2);
}
else if(h1==h2&&m1<m2){
m=m2-m1;
}
else if(h1>h2){
h=24-(h1-h2);
m=(h*60)+(60-m1)-(60-m2);
}
else{
h=h2-h1;
m=(h*60)-(60-m2)+(60-m1);
}
printf("%d\n",m);
}
return 0;
}
Problem number: 10018
Problem name: Reverse and Add
#include<stdio.h>
int main()
{
long long int n,m,a,b,c,t,x;
scanf("%lld",&t);
while(t--){
scanf("%lld",&n);
x=0;
while(1){
m=n;
c=0;
while(n!=0){
c=c*10+n%10;
n/=10;
}
x++;
if(c==m){
break;
}
else{
n=c+m;
}
}
printf("%lld %lld\n",x-1,c);
}
return 0;
}
Problem no: 11854
Problem no: 11854
Problem name: Egypt
#include<stdio.h>
int main()
{
long a,b,c,d,e,f;
while(scanf("%ld %ld %ld",&a,&b,&c)==3){
d=a*a;
e=b*b;
f=c*c;
if(a!=0 || b!=0 ||c!=0){
if(f==d+e)
printf("right\n");
else if(d==e+f)
printf("right\n");
else if(e==d+f)
printf("right\n");
else
printf("wrong\n");
}
}
return 0;
}
No comments:
Post a Comment