# Andrew Stankevich & amp; #39; s Contest (21)

Source: Internet
Author: User

Andrew Stankevich & #39; s Contest (21)
F-"Money, Money, Money"Time Limit:2000/1000 MS (Java/Others)Memory Limit:128000/64000 KB (Java/Others) Special JudgeSubmitStatusProblem Description The government of Flatland has decided to carry out the money system reform. the purpose of the reform is to reduce the number of different banknotes denominations down to two. after the reform there will be two types of banknotes-a tupiks and B tupiks.
The problem is that the president of Flatland doesn't like the number x. therefore the minister of finances was extends ucted to choose such a and B that it is impossible to pay exactly x tupiks without change. on the other hand it must be possible to pay all amounts larger than x.
Now you are asked to help him-choose such a and B, or recommend the minister to retire, if it is impossible. input file contains one number x (1 ≤ x ≤1012 ). output two integer numbers a and B, such that it is impossible to pay x tupiks using banknotes of a and B tupiks without change, but it is possible to pay any larger sum. if it is impossible, output two zeroes to the output file. sample Input

`345`
Sample Output
`2 50 03 4`
`It is easy to know that any natural number can be expressed in the form of (2 * x + ODD). Therefore, for any odd number z, we can always find two numbers a, B, make it possible to construct all numbers greater than z; // for an even number, it cannot be constructed. (we hope the Giants can prove it)`

`AC code:`
```/** this code is made by eagle* Problem: 1408* Verdict: Accepted* Submission Date: 2014-10-03 07:05:36* Time: 0MS* Memory: 1676KB*/#include

using namespace  std;typedef long long ll; int main(){       ll a;       while(cin>>a){           if(a & 1){               cout<<2<<" "<

```
Related Keywords:
Related Article

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.