URAL 2001. Mathematicians and Berries
2015-03-20 19:27
316 查看
2001. Mathematicians and Berries
Time limit: 0.5 secondMemory limit: 64 MB
One day, two mathematicians were walking in the forest and picking berries. They’d been walking for two hours, and then they stopped and decided to see who’s got more berries. They took out the scales
(can you imagine a mathematician going to the forest without any scales?) and they weighed their baskets with berries. They wrote the resulting numbers a1 and b1 down
on a piece of paper. Then the second mathematician put all his berries to the first one’s basket (so that his basket became completely empty) and they weighed their baskets again and they received numbers a2 and b2,
correspondingly. At last, the first mathematician put all the berries to the second one’s basket (so that his basket became completely empty); they weighed the baskets and got numbers a3 and b3,
correspondingly. This data was enough to find the winner and the happy mathematicians moved on. Your task is to calculate the mass of the berries in each mathematician’s basket by the start of the competition.
Input
The input data consists of three lines. The i’th line (1 ≤ i ≤ 3) contains integers ai and bi (0≤ ai, bi ≤ 10 000).
Output
Output the weight of berries in the basket of the first and the second mathematician correspondingly.Sample
input | output |
---|---|
1 2 2 1 0 3 | 1 1 |
#include<cstdio> #include<iostream> using namespace std; int a[10]; int main() { int j=0; for(int i=0;i<3;i++) { cin>>a[j++]; cin>>a[j++]; } cout<<a[0]-a[4]<<" "<<a[1]-a[3]<<endl; return 0; }
相关文章推荐
- E - Friends and Berries URAL - 2067 ----三点共线
- E - Friends and Berries URAL - 2067(三点共线)
- URAL 2067 Friends and Berries (推理,数学)
- URAL 2067 Friends and Berries
- Ural 2067 Friends and Berries 【思维】
- 【Ural1277】 Cops and Thieves 无向图点连通度问题
- 【bitset+string+关闭流同步优化】Oleg and Little Ponies URAL - 2108
- Ural 2040. Palindromes and Super Abilities 2 回文自动机
- URAL 1553. Caves and Tunnels 树链剖分
- URAL 1960 Palindromes and Super Abilities (Palindromic Tree)
- hdu 3068 and ural 1297
- URAL 1635. Mnemonics and Palindromes(DP)
- 【URAL】1553 Caves and Tunnels
- URAL 2019. Pair: normal and paranormal(***栈模拟)
- Ural 1635 Mnemonics and Palindromes(DP)
- G - Mnemonics and Palindromes 3 URAL - 1737(回文)
- URAL1915_Titan Ruins: Repeating Success and Failure_复杂度分析、机智
- Ural 1548 Sakura and Statistics
- URAL 2040 Palindromes and Super Abilities 2 (Palindromic Tree)
- URAL 1553 Caves and Tunnels(树链剖分-点更新-区间最值查)