ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1409. Two Gangsters

wrong answer
Posted by Freddy 25 Jul 2011 00:00
why wrong answer?

#include"iostream"

int main()
{

int banki=10;
int Garry,Larry;
std::cin>>Garry>>Larry;
std::cout<<banki-Garry<<" "<<banki-Larry;
return 0;
}
Re: wrong answer
Posted by ISS 22 Jun 2012 21:05
because its wrong - int banki=10
Re: wrong answer
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
Re: wrong answer
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
Re: wrong answer
Posted by lone_wolf_000 26 May 2021 02:52
actually the twist is in the number of total canes.

Edited by author 26.05.2021 02:53

Edited by author 26.05.2021 02:53