Case 1: Did this with my code and it was not accepting 5 times
#include <stdio.h>
int main()
{
int a,b,min,max;
int T,i;
scanf("%d",&T);
for(i=0;i<T;i++)
{
scanf("%d %d",&a,&b);
max=a+b;
min= b ^ ((a ^ b) & -(a < b));
printf("%d %d\n",min,max);
}
return 0;
}
Case 2: (Accepted) Did this with my code and it was accepted the first time ( but the logic in both cases is the same yet one accepted second not. Help out to what went wrong.
#include<stdio.h>
int main()
{
int N,i,a,b,max;
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%d %d",&a,&b);
max=a+b;
if(a>b)
{
printf("%d %d\n",a,max);
}
else
printf("%d %d\n",b,max);
}
return 0;