Kindly tell the flaw in the code?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2008
Posts: 1
Reputation: rebelvarun is an unknown quantity at this point 
Solved Threads: 0
rebelvarun rebelvarun is offline Offline
Newbie Poster

Kindly tell the flaw in the code?

 
0
  #1
Mar 28th, 2008
the question is from ----acm.timus.ru "PROBLEM 1095"-VOLUME 1-"Nikifor 3"
Nikifor knows that a certain positive integer has in its decimal form each of the digits 1,2,3,4. You are asked to determine if Nikifor can rearrange the digits of the number in such a way that the new number divides by 7.
Input:

The first line of the input contains the number N (not exceeding 10000) of positive integers that are to be checked. The next N lines contain these integers. Each number has no more than 20 digits.
Output:

For each of the N numbers you should output a number divisible by 7 that can be obtained from the corresponding number from the input file by a rearrangement of the digits. If such rearrangement does not exist you should output 0 in the corresponding line. In the case of several valid rearrangements you may find only one of them.
Kindly look in to the attached file and tell the flaw in the code....:-)....->
Last edited by rebelvarun; Mar 28th, 2008 at 5:20 am.
Attached Files
File Type: cpp 1095.cpp (1.4 KB, 6 views)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC