| | a, b = map(int, input().split())print(10-a, 10-b)
 Их не обязательно 10! то есть всего банок a + b - 1Total_Cans = a+b-1
 then, print(Total_Cans-a, Total_Cans-b)
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
#include<iostream>using namespace std;
 int main()
 {
 int a, b;
 cin >> a >> b;
 cout << b-1 << ' ' << a - 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;
 }
#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;
 
 }
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.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
#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
Seems an easy problem, but I can't understand it... 4 7 - input data1  - 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
if2 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
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...
[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.Hiyou 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
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)
[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 LOOOOLYou must use smaller type: BYTEWhat 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)){
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! а сколько именно нам неизвестно ну тогда напиши так,чтобы тот кто компилирует имел возможность вводить свое числоА ещё надо помнить, что последнюю банку они прострелили оба.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 -------------------- #
#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);
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;
 }
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....
 | 
 |