You are not logged in. Please login at www.codechef.com to post your questions!

×

Why Codechef rejected my code (Chef and digits of a number)

include<stdio.h>

int main() { long long int t,num,temp,count1,count0,b; scanf("%lld",&t); while(t--) { scanf("%lld",&num); temp=0,b=0; temp=num; count1=0,count0=0; while(temp!=0) { b=temp%10; if(b==1) count1++; else if(b==0) count0++; temp/=10; } if(num==1||num==0) printf("Yes\n"); else { if((count1>1&&count0>1)||count1==0||count0==0) printf("No\n"); else if(count1==1&&count0>1) printf("Yes\n"); else if(count0==1&&count1>1) printf("Yes\n"); else if(count1==1&&count0==1) printf("Yes\n");

 }

}return 0; }

asked 08 Nov, 23:48

milanshu_185's gravatar image

0★milanshu_185
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,554
×921
×605
×129
×19

question asked: 08 Nov, 23:48

question was seen: 55 times

last updated: 08 Nov, 23:48