| | |
Kindly tell the flaw in the code?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2008
Posts: 1
Reputation:
Solved Threads: 0
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....:-)....->
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.
![]() |
Other Threads in the C++ Forum
- Previous Thread: tetris game using pointers
- Next Thread: Segmentation Fault core dump..please help!
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





