Submit | All submissions | Best solutions | Back to list |
JULKA - Julka |
Julka surprised her teacher at preschool by solving the following riddle:
Klaudia and Natalia have 10 apples together, but Klaudia has two apples more than Natalia. How many apples does each of he girls have?
Julka said without thinking: Klaudia has 6 apples and Natalia 4 apples. The teacher tried to check if Julka's answer wasn't accidental and repeated the riddle every time increasing the numbers. Every time Julka answered correctly. The surprised teacher wanted to continue questioning Julka, but with big numbers she could't solve the riddle fast enough herself. Help the teacher and write a program which will give her the right answers.
Task
Write a program which
- reads from standard input the number of apples the girls have together and how many more apples Klaudia has,
- counts the number of apples belonging to Klaudia and the number of apples belonging to Natalia,
- writes the outcome to standard output
Input
Ten test cases (given one under another, you have to process all!). Every test case consists of two lines. The first line says how many apples both girls have together. The second line says how many more apples Klaudia has. Both numbers are positive integers. It is known that both girls have no more than 10100 (1 and 100 zeros) apples together. As you can see apples can be very small.
Output
For every test case your program should output two lines. The first line should contain the number of apples belonging to Klaudia. The second line should contain the number of apples belonging to Natalia.
Example
Input: 10 2 [and 9 test cases more] Output: 6 4 [and 9 test cases more]
Added by: | Adam Dzedzej |
Date: | 2004-06-08 |
Time limit: | 2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS PERL6 VB.NET |
Resource: | Internet Contest Pogromcy Algorytmow (Algorithm Tamers) Round II, 2003 |
hide comments
|
||||||||||||||
2014-12-07 08:48:52 Kartik Chopra
what about test case 10 1? It cannot exist mathematically |
||||||||||||||
2014-12-04 20:43:18 Shivam Kapoor
AC in first go :D piece of cake! |
||||||||||||||
2014-12-03 21:17:18 Dhruv k14
BigInteger <3 JAVA <3 |
||||||||||||||
2014-12-01 07:39:15 Utkarsh
Should it be like this : 1st test case input 1st test case output 2nd test case input 2nd test case output ... and so on ? Please help ... |
||||||||||||||
2014-11-25 06:43:22 Pawan Dwivedi
check for 2003 69 output 1036 967 |
||||||||||||||
2014-11-19 13:37:24 HITESH GARG
help me... with my code <snip> Last edit: 2022-07-04 23:32:51 |
||||||||||||||
2014-11-15 22:36:20 Faiz Malik
Python <3 (5 line code) ;) |
||||||||||||||
2014-10-22 17:41:44 Gopesh Tulsyan
ruby rocks! |
||||||||||||||
2014-09-28 18:39:08 /* EDWARD KENWAY */
use c/c++,if u really want to enjoy this problem! |
||||||||||||||
2014-09-23 07:09:59 Lalit Kumar
pls help what's wrong with this code <snip> Last edit: 2022-07-04 23:32:46 |