|
|
Maybe you forgot that the order of the numbers in the answer is important. pls help, what is in test №14 may be anybody know? Edited by author 13.09.2016 16:35 Edited by author 13.09.2016 16:35 Maybe this: 2 2 1 Edited by author 04.05.2020 18:52 #include <iostream> using namespace std; int main() { long x, y, c, a, b, MIN, MAX; cin >> x >> y >> c; if (x + y < c) { cout << "Impossible"; return 0; } if (x >= c) cout << c << " " << 0; else if (y >= c) cout << 0 << " " << c; else{ if (x < y) cout << x << " " << c - x; else cout << c - y << " " << y ; } } Please, do not publish your accepted solution code on forum. You disable other people to put their mind on the task in such a manner. Please respect other possibility to solve a task on their own. I think that if people don't need an answer they will not watch it. But if they need to see it, an answer is very useful to them, they can find their mistakes and to learn one more variant of programming. Also I watched answers of other people but it absolutely doesn't mean I answered the same on that problems and haven't put my own mind on the tasks. Please, do not publish your accepted solution code on forum. You disable other people to put their mind on the task in such a manner. Please respect other possibility to solve a task on their own. Edited by author 30.01.2019 03:06give me tests,please! all my tests give ok results. i have wa 19. help! Edited by author 21.01.2018 17:25 I got WA 14 and after I fixed the program to handle the first test, it went AC. 5 2 7 5 2 2 5 7 2 5 1000 1000 1 1 0 or 0 1 1 500 5 1 4 or 0 5 2 3 10 Impossible 5 1 5 5 0 or 4 1 2 1 0 0 0 Edited by author 02.10.2018 09:12 add test x = y; x + y < c; x, y < c example input: 900000000 900000000 1000000000, i had AC with output 900000000 900000000 i wrote code using int (not long) and got AC. Add more tests! How do it more fast? #include <iostream> using namespace std; int main() { int x, y, c;
cin >> x >> y >> c;
if((x + y) < c) { cout << "Impossible" << endl; } else { for(int i = 0; i <= x; i++) { for(int j = 0; j <= y; j++) { if((i + j) == c) { cout << i << " " << j << endl; return 0; } } } } } Edited by author 13.10.2015 20:23 Edited by author 13.10.2015 20:23 Here is other way to solve If U have X u do not need finding Y Edited by author 20.04.2016 18:25 Just list all of cases like x>=y>=c or y>=x>=c and you'll understand I came up with a solution that deals with the problems mentioned in the other topics, but still get wa on test 7 after I tried all tests that I could think of. Why is this? Does anybody know what test 7 is? Thanks in advance! :) Edited by author 13.10.2015 22:03 Remember that X ONLY applies to A and Y ONLY applies to B. For example: 7 5 11 Your answer can be 6 5, but it cant be 5 6. Remember that X ONLY applies to A and Y ONLY applies to B. For example: 7 5 11 Your answer can be 6 5, but it cant be 5 6. Hi, how do you fixed this test? Remember that X ONLY applies to A and Y ONLY applies to B. For example: 7 5 11 Your answer can be 6 5, but it cant be 5 6. Write me novopashinwm@mail.ru using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _2035 { class Program { static void Main(string[] args) { string[] arrS = Console.ReadLine().Split(' '); long a = long.Parse(arrS[0]); long b = long.Parse(arrS[1]); long c = long.Parse(arrS[2]); //10^9 =1 000 000 000 if (((c - b) > a && (c-b)>0)) Console.WriteLine("Impossible"); else if (((c - a) > b && (c-a)>0)) Console.WriteLine("Impossible"); else if ((c - b) > 0 ) Console.WriteLine("{0} {1}", (c - b), b); else Console.WriteLine("{0} {1}", (c - a), a);
} } } Edited by author 06.03.2015 12:54 found my mistake. sorry for this post. Edited by author 05.12.2014 22:16 Edited by author 05.12.2014 22:16 Edited by author 25.10.2014 15:23 |
|
|