Show all threads Hide all threads Show all messages Hide all messages |
why its wrong? | Владислав | 1409. Two Gangsters | 24 Aug 2023 21:51 | 2 |
a, b = map(int, input().split()) print(10-a, 10-b) Их не обязательно 10! то есть всего банок a + b - 1 |
whats wrong with 10-b and 10-a | md adullah al mamun udoy | 1409. Two Gangsters | 5 Jan 2023 23:38 | 2 |
whats wrong with this logic? cout<<10-a<<" "<<10-b<<endl; All cans = Harry shot + Larry shot - 1; Not shot by Harry = All cans - Harry shot; Not shot by Larry = All cans - Larry shot; Edited by author 05.01.2023 23:48 |
what is the mistake here and why the limit of 10 cans? | hellknife | 1409. Two Gangsters | 15 Sep 2022 23:48 | 1 |
#include<iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << b-1 << ' ' << a - 1; } |
Why it's wrong? | Solaiman Shadin | 1409. Two Gangsters | 1 May 2022 13:03 | 1 |
#include<stdio.h> int main() { int h, l; scanf("%d %d", &h, &l); int total = h + l; printf("%d %d\n", total - l - 1, total - h - 1); return 0; } |
why is wrong? | Crisfigueroa | 1409. Two Gangsters | 5 Apr 2022 07:50 | 1 |
#include <stdio.h> #include <stdlib.h> int main(){ int harry,larry,res,res1,c; scanf("%d %d",&harry,&larry); c=(harry+larry)-1; if(c<=10){ res1=10-harry; res=10-larry; printf("%d %d \n", res1,res); }else
return 0; } |
AC | Saligzhanov_KB_13 | 1409. Two Gangsters | 7 Feb 2022 19:54 | 2 |
AC Saligzhanov_KB_13 14 Dec 2013 07:25 Got this by first try, I didn't opened IDE, didnt'y opened even notepad. I wrote it right in the input box. Too easy. |
wrong answer | Freddy | 1409. Two Gangsters | 26 May 2021 02:52 | 5 |
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; } because its wrong - int banki=10 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 =) 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 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 |
why this solution is wrong? | Gleb | 1409. Two Gangsters | 16 May 2021 03:02 | 3 |
#include<iostream> using namespace std; int main() { int a; int b; int c; int d; int h; cin>>a; cin>>b; h=a-1+b; c=h-a; d=h-b; cout<<c; cout<<d; return 0; } You should test your code locally before submitting, this way you will notice that you missed a space! I've simplified your way. use the following, you'll get the result - c = b - 1; d = a - 1; cout<<c<<" "<<d; Edited by author 16.05.2021 03:02 |
What's the meaning of this problem? | RoBa @ TJU | 1409. Two Gangsters | 3 Jul 2020 00:57 | 13 |
Seems an easy problem, but I can't understand it... 4 7 - input data 1 - common can (4+7)-1=10 - amount of cans How can you get "1-common can"? Or the problem says there must be one common can? At some moment it happened so that they shot the same can - last can Still a little puzzled... Anyway I have got AC, thx for your help :) why I am wrong on test2,it seems very easy "The 12th High School Pupils Collegiate Programming Contest of the Sverdlovsk Region (October 15, 2005)" What a mockery ?!?! cin >> h >> l; cout << l-1 << " " << h-1; And that's all ... (0.001 sec and 220Kb memory used :) ) P.S. 137Kb if it's transformed for C Edited by author 06.10.2006 00:10 if 2 3 - imput data 1 common can (2+3)-1=4 - amount of cans readln(n,m); writeln(m-1,' ',n-1); I can explain it easily. 1 1 1 1 "1" 1 1 1 1 1 1 1 the quoted 1 is the can which they will shot it at the same time. hope i helped after 4 years :D Yes it has helped me after 9 more year Edited by author 03.07.2020 00:58 |
Why WA? | ANTAR NANDI | 1409. Two Gangsters | 11 Jun 2019 15:05 | 1 |
Why WA? ANTAR NANDI 11 Jun 2019 15:05 |
Wrong Answer || Compiler: GCC 7.1 | Meraj al Maksud | 1409. Two Gangsters | 13 Feb 2018 04:59 | 3 |
I don't understand what's wrong with my code. Help me pls. Thnx in advance. #include<stdio.h> int main(){ int L, H; scanf("%d%d", &L, &H); printf("%d %d ", 10 - L, 10 - H); return 0; } It said not more than 10 cans... thus there could be less than 10 cans Once Harry and Larry shoot a common can... you gotta consider that too... |
Python 2.7 | Evgeny | 1409. Two Gangsters | 19 Jul 2017 12:33 | 3 |
[code deleted] === Return "Fail (checker)", why? Edited by moderator 20.11.2019 00:01 the necessary conditions to enter through the gap, and you have 2 line this. Hi you need to split a and b [code deleted] good luck Edited by author 19.07.2017 12:34 Edited by moderator 20.11.2019 00:01 |
No subject | KAKTUS_OK | 1409. Two Gangsters | 6 Apr 2017 20:31 | 6 |
KTO NIBUD PONIMAET, KAK EE RESHIT #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << --b << " " << --a; return 0; } vot) |
Accepted | tarashi | 1409. Two Gangsters | 16 Feb 2017 17:46 | 7 |
[code deleted] Edited by moderator 19.11.2019 23:54 Could you tell me why? Thanks in advance!! Edited by author 29.07.2008 17:35 Actually,it is a "check"... lol, your algo works as much as 0.031 seconds. but mine works 0.015: [code deleted] Edited by moderator 19.11.2019 23:55 [code deleted] //c language. 0.001 sec Edited by moderator 19.11.2019 23:55 but mine works 0.001 LOOOOL You must use smaller type: BYTE |
Output limit exceeded | sikder_social | 1409. Two Gangsters | 30 Sep 2016 19:40 | 3 |
What is wrong in my code? Thanks [code deleted] Edited by moderator 19.11.2019 23:57 Well, there's only two numbers in the input. For some reason you're using while, and for some reason it leads to infinite cycle apparently. Try to replace your while with if. Also, you assume there's exactly 10 cans total. This is not true. The task says "no more than 10". Edited by author 30.09.2016 18:25 while becomes endless because of mistake: Current state: while(scanf("%d %d",&a,&b)!=EOF && a<11 || b<11){ Should be: while(scanf("%d %d",&a,&b)!=EOF && (a<11 || b<11)){ |
wrong answer | Kornievskij.a | 1409. Two Gangsters | 12 Jun 2016 19:21 | 5 |
why wrong answer?? help please. var a,b,c,d:integer; begin readln(a,b); c:=10-a; d:=10-d; writeln(c); writeln(d); end. с чего ты взял, что банок 10? там сказано, что не более 10! а сколько именно нам неизвестно ну тогда напиши так,чтобы тот кто компилирует имел возможность вводить свое число А ещё надо помнить, что последнюю банку они прострелили оба. |
1409 Runtime Error | Nitchakarn | 1409. Two Gangsters | 25 Jun 2015 10:06 | 1 |
Dear All, I am a student and I got an assignment from my teacher to run "1409 Two Gangsters". I write Python program v.2.7 as per following codes. I run the program many times, but it still showed "Runtime Error". I could not fix it. It would be appreciated if someone can help me. Thanks. # 1409 Two Gangsters (Created: 24th June 2015 / Python 2.7) # -------------------- Start of Program -------------------- # # Set initial values total = 0 # total number of cans shot by Harry and Larry Harry = 0 # the number of cans shot by Harry Larry = 0 # the number of cans shot by Larry h = 0 # the number of cans that were not shot by Harry l = 0 # the number of cans that were not shot by Larry Harry = int(input("Please enter the number of cans shot by Harry: ") Larry = int(input("Please enter the number of cans shot by Larry: ")
# Calculation of "The number of cans that were not shot by Harry and Larry" total = Harry + Larry -1 h = total - Harry l = total - Larry # Output print "-"*100 print "Total number of cans are : ", total print "The number of cans that were not shot by Harry and Larry are ", h, "and", l, "respectively." print "-"*100 # -------------------- End of Program -------------------- # |
whats wrong????? | shubham | 1409. Two Gangsters | 1 May 2015 10:39 | 2 |
#include<stdio.h> void main() { int harry, larry; int sum; int harryleft, larryleft; scanf("%d%d", harry, larry); sum = (harry + larry)-1; harryleft = sum - harry; larryleft = sum - larry; printf("%d%d", harryleft, larryleft); return 0; } Here's the necessary changes: int main() scanf("%d%d", &harry, &larry); |
Wrong answer | Pavel | 1409. Two Gangsters | 24 Feb 2015 16:47 | 2 |
why wrong answer? #include <iostream> using namespace std; int main() { int banki=10, banki_s, bankis_ss; cout << "Harry shot cans: "; cin >> banki_s; cout << "Larry shot cans: "; cin >> bankis_ss; cout << "Harry shot: " << (banki - banki_s) << endl; cout << "Larry shot: " << (banki - bankis_ss) << endl;
return 0; } int main() { code: int banki, banki_s, bankis_ss; cout << "Harry shot cans: "; cin >> banki_s; cout << "Larry shot cans: "; cin >> bankis_ss; banki = (banki_s + bankis_ss) - 1; cout << "Harry shot: " << (banki - banki_s) << endl; cout << "Larry shot: " << (banki - bankis_ss) << endl; system("PAUSE"); return 0; } |
there's always one common can | Zero | 1409. Two Gangsters | 4 May 2014 10:11 | 2 |
why output b-1 and a-1 you will get an AC? because there's always one common can in this way there are a+b-1 cans in total then Larry has a+b-1-a=b-1 cans left so does Harry the statement is very unclear.... |