Help me in solving CGYM problem

My issue

the output is coming same but on submitting the ans is showing wrong

My code

#include <stdio.h>

int main(void) {
int t,a,b,c,d;
scanf("%d",&t);
while(t--) {
  scanf("%d" "%d" "%d",&a,&b,&c);
  if(a+b<=c) {
      printf("2\n");
  }
  else if(a<c) {
      printf("1\n");
  }
  else {
      printf("0\n");
  }
}

}


Learning course: 500 difficulty rating
Problem Link: Chef and Gym Practice Problem in - CodeChef

@prachic861
U have to do it like this

#include <stdio.h>

int main() {
	// your code goes here
    int x,y,z,t;
    scanf("%d",&t);
    while(t--){
        scanf("%d%d%d",&x,&y,&z);
        if(x+y<=z)
        printf("2\n");
        else if(z>=x)
        printf("1\n");
        else
        printf("0\n");
    }
}
1 Like