1.
#include<stdio.h>
int main(){
int t1, t2;
scanf("%d %d", &t1, &t2);
int a = t1 / 100 * 60 + t1 % 100;
int b = a + t2;
printf("%03d\n", b / 60 * 100 + b % 60);
return 0;
}
2.
#include <stdio.h>
int check(int y,int m,int d,int days) {
if(m < 1 || m > 12 || d < 1 || d > 31)return 0;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if ((y % 4 == 0 && y % 100) || y % 400 == 0)month[2] += 1;
for (int i = 1; i < m; ++i) {
days += month[i];
}
return days+d;
}
int main(){
int y,m,d,days=0;
scanf("%d/%d/%d",&y,&m,&d);
printf("%d", check( y, m, d,days));
return 0;
}
3.
# include<stdio.h>
int main()
{
int a,b,c,flag=0;
char ch;
scanf("%d",&a);
while((ch=getchar())!='=')
{
scanf("%d",&b);
if((ch=='/')&&(b==0))
{
flag=1;break;
}
switch(ch)
{
case '+': a=a+b;break;
case '-':a=a-b;break;
case '*':a=a*b;break;
case '/':a=a/b;break;
default :
flag=1;break;
}
if(flag) break;
}
if(flag)
{
printf("ERROR");
}
else
{
printf("%d",a);
}
return 0;
}
4.
#include<stdio.h>
int gcd(int a,int b){
return (b ? gcd(b,a % b) :a);
}
int main(){
int a,b;
scanf("%d %d",&a,&b);
int g = gcd(a,b);
int lcm = a*b/gcd(a,b);
printf("%d"" ""%d",g,lcm);
return 0;
}