Ask Experts Questions for FREE Help !
Ask
    blisskinny's Avatar
    blisskinny Posts: 1, Reputation: 1
    New Member
     
    #1

    Oct 21, 2007, 03:31 AM
    G. Next Number
    Frank Tarantini is the main weapons specialist in the gang of Vito Maretti. He buys stolen weapons and forges the gun numbers. After that the weapons is given to the other gangsters.

    Recently Vito has charged Frank with the assignment to procure 20 new tommy-guns. Frank has fulfilled the assignment the same night. Now he is to change the guns numbers. In order not to arouse suspicion Frank uses as a new gun number the minimal next one with the same sum of digits. It takes 30 minutes to find such number because Frank is a gangster, not mathematician. But today he is short of time. So you are under the threat of one of his new tommy-guns. He wants you to write a program that would find the suitable number.

    Input
    consists of the k-digit number N – the old number of a tommy-gun (1 <= K <= 2000, 0 <= N <= 101000).

    Output
    the new K-digit number that Frank needs or -1 if there is no such number.

    Samples

    input
    113
    0050

    output
    122
    0104
    asterisk_man's Avatar
    asterisk_man Posts: 476, Reputation: 32
    Full Member
     
    #2

    Oct 22, 2007, 06:19 AM
    Where are you having trouble? We won't do your homework for you but we will help you with questions.
    jai_1233's Avatar
    jai_1233 Posts: 1, Reputation: 1
    New Member
     
    #3

    May 18, 2011, 09:50 PM
    Quote Originally Posted by blisskinny View Post
    Frank Tarantini is the main weapons specialist in the gang of Vito Maretti. He buys stolen weapons and forges the gun numbers. After that the weapons is given to the other gangsters.

    Recently Vito has charged Frank with the assignment to procure 20 new tommy-guns. Frank has fulfilled the assignment the same night. Now he is to change the guns numbers. In order not to arouse suspicion Frank uses as a new gun number the minimal next one with the same sum of digits. It takes 30 minutes to find such number because Frank is a gangster, not mathematician. But today he is short of time. So you are under the threat of one of his new tommy-guns. He wants you to write a program that would find the suitable number.

    Input
    consists of the k-digit number N – the old number of a tommy-gun (1 <= K <= 2000, 0 <= N <= 101000).

    Output
    the new K-digit number that Frank needs or -1 if there is no such number.

    Samples

    input
    113
    0050

    output
    122
    0104
    Hi Any one know the answer of this question. Or hints of this question. *** reply as soon as.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Number 3 [ 1 Answers ]

What do I need to adjust if the unearned fees at August 31 is $1500 and the unbilled fees at August 31 is 6,780

If I register for a business number in Canada and provide my social Insurance number. [ 1 Answers ]

If I register for a business number in Canada and provide my social Insurance number.. ... will my SIN always be "connected" with my business? In other words, as far as Canada REvenue is concerned are they 2 different entities? I want to apply for Bus # for a sole propriatorship

Need the next number [ 1 Answers ]

52, 28,33, 63, 73, 23, 56... Can anyone tell me the next number in this sequence?:confused:

A little number theory [ 3 Answers ]

Here's a problem maybe you number theorists will like. Just an exercise in modular arithmetic. Think about Fermat's little theorem. "Find the remainder when 5^{100} is divided by 7". Yes, you could use a good calculator, but that's no fun.


View more questions Search