Solution of Codechef - May Challenge 2014 - Chef Jumping in C
"He who is fixed to a star does not change his mind." -Leonardo da VinciI found this problem at http://www.codechef.com/MAY14/problems/OJUMPS .
Solution:-
#include <stdio.h>
int main(){
long long a;//i;
int flag=0,r;
char yes[]="yes",no[]="no";
fscanf(stdin,"%lld", &a);
r=a % 6;
flag=(r==0 || r==1 || r==3)? 1 : 0;
if(flag){
fprintf(stdout,"%s",yes);
}else{
fprintf(stdout,"%s",no);
}
return 0;
}
Comments
Post a Comment