ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1409. Two Gangsters

Posted by Freddy 25 Jul 2011 00:00

#include"iostream"

int main()
{

int banki=10;
int Garry,Larry;
std::cin>>Garry>>Larry;
std::cout<<banki-Garry<<" "<<banki-Larry;
return 0;
}
Posted by ISS 22 Jun 2012 21:05
because its wrong - int banki=10
Posted by Ilya_novichok 3 Jul 2013 01:44
Why this solution is wrong?

#include <iostream>
using namespace std;

int main()
{
int herry;
int larry;
int all;
cin >> herry;
cin >> larry;
all=herry+larry-1;
herry=all-larry;
larry=all-herry;
cout << herry << " " << larry;
return 0;
}

Edited by author 03.07.2013 01:45
Posted by SazanovSasha 25 Sep 2013 18:16
=)

Do you know math?

Code:
all=herry+larry-1;
herry=all-larry;
larry=all-herry;

Math:
all=herry+larry-1;
herry=all-larry=herry+larry-1-larry=herry-1;
larry=all-herry=herry+larry-1-(herry-1)=larry;

Edited by author 25.09.2013 18:28