CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
    • Event Calendar
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » CE 2010 » Numb3rs

Numb3rs

Problem code: CE02

  • All Submissions

It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.
WAP to check that if 2 such numbers have this property

Input:

The first line will consist of the total number of test cases T(1<=T<=10).
The next T lines will consist of one number on each line. This is the number N(1<=N<=100000000).

Output:

For each test case, output a single line which returns 1 if the 2 numbers satisfy the above said conditions and 0 otherwise

Example:
Input:

5
23
45
123
123
1234
123
1223
1222
1223
1234

Output:

0
1
0
0
0


Author: cerebration
Date Added: 22-03-2010
Time Limit: 1 sec
Source Limit: 50000 Bytes
Languages: BF, CLOJ, CPP 4.3.2, F#, GO, JS, PERL6, PRLG, PYTH 3.1.2, TEXT, WSPC


  • Submit

Comments

  • Login or Register to post a comment.

test cases are wrong all

bst0602 @ 25 Mar 2010 10:07 PM

test cases are wrong all output 'd be 0

where to register for this

wiwbiz @ 26 Mar 2010 03:10 AM

where to register for this and what is this contest ?

I did not understand the

mcsharma1990 @ 26 Mar 2010 02:57 PM

I did not understand the qns..can somebody please expalin?

@mahesh : the second number

geopaulm @ 26 Mar 2010 03:08 PM

@mahesh : the second number shld contain the xact digits the xact no of times as in the first number.. but the order can be changed!! :)

why wrong answer is coming

heeropunjab @ 28 Mar 2010 09:24 PM

why wrong answer is coming

Yes I am too getting wrong

Debanjan @ 29 Mar 2010 07:28 AM

Yes I am too getting wrong answer ! Is there any special case to satisfy in the outputs ?

I am getting reapeated WA ! I

Debanjan @ 29 Mar 2010 10:59 AM

I am getting reapeated WA ! I have used 3 diferrent strategies,all of them works correctly for the original project euler problem which the author seems to be inspired from.

 

Please some one clarify the I/O.

Why nobody is clarifying the

Debanjan @ 30 Mar 2010 01:13 AM

Why nobody is clarifying the I/O ? Copletely moronic problem is getting WA's !

@Debanjan I/O is absolutely

linuxfreak @ 30 Mar 2010 11:25 AM

@Debanjan I/O is absolutely correct... count the no of inputs.. against the no of test cases... then... see the corresponding output!!! Just.. use problem statement for understanding the problem.. but write program for the I/O given!!!

The sample input and output

cerebration @ 30 Mar 2010 07:41 PM

The sample input and output is absolutely correct,please read the questions properly and answer,also there have been various successful submissions so the error is with your own program

@ Rohan I have solved all the

shadow @ 30 Mar 2010 10:31 PM

@ Rohan I have solved all the 7 prob, My name was there in the rankings but after some time i see my name is nowhere in the list. Is there any prob with the rankings. Please see to it.

 

Thanks

@Gunjan That is not really up

cerebration @ 30 Mar 2010 11:01 PM

@Gunjan That is not really up to me as it is controlled by codechef,please mail them about this

Its ok now sorry to bother

shadow @ 31 Mar 2010 12:08 AM

Its ok now sorry to bother you :)

@Rohan Garg: >The sample

Debanjan @ 31 Mar 2010 12:14 AM

@Rohan Garg:

>The sample input and output is absolutely correct,please read the questions properly and answer,also there >have been various successful submissions so the error is with your own program

 

Yes,I was too much obsessed with PE-52.Sometimes it's better to sleep ! Thanks.

@ Rohan Garg Actually, it is

triplem @ 31 Mar 2010 04:49 AM

@ Rohan Garg

Actually, it is not correct at all, if you read the problem statement carefully. It clearly says: 'contain exactly the same digits, but in a different order.'

The output shows 1 for a test case despite the fact the digits are not in a different order. Of course, everyone has ignored the problem statement and used the sample output, which is why there are correct solutions.

abe kya natak laga

akashheart02 @ 31 Mar 2010 08:58 PM

abe kya natak laga rakha

suno yaar tumhe pahele batana chahiye tha ya email karna chahiye tha

this is not fair with us.

I spent my whole day for solving these problems now you are saying you haven't registred.

sending information of this much value throungh comment is not good.

please be fair in judging.

:(

:(

:(

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of computer programming. At CodeChef we work hard to revive the geek in you by hosting programming contests on a monthly basis. We also aim to have training sessions and events related to online programming for programmers around the world. Apart from providing a platform for programming competitions, CodeChef also has various tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our judge accepts solutions in over 35+ programming languages. Online programming was never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming competitions that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly programming contests and the shorter format Cook-off programming contests. Put yourself up for recognition and win great prizes. Prizes worth up to Rs.20,000 and $700 are up for grabs every month along with lots more CodeChef goodies.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be part of CodeChefs Forums and interact with all our programmers love helping out other programmers and share their ideas.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. Be a part of the CodeChef community through CodeChef meetups and techtalks. You can also host a programming contest for your institute on CodeChef and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com