URAL 2001 Mathematicians and Berries (小学数学题)

33 篇文章 0 订阅

Mathematicians and Berries

Time limit: 0.5 second
Memory 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  a 1 and  b 1 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  a 2 and  b 2, 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  a 3 and  b 3, 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  a i and  b i (0 ≤  a ib i ≤ 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




解析:简单计算。



AC代码:

#include <cstdio>

int a[3], b[3];

int main(){
    while(scanf("%d%d%d%d%d%d", &a[0], &b[0], &a[1], &b[1], &a[2], &b[2])==6){
        printf("%d %d\n", a[0] - a[2], b[0] - b[1]);
    }
    return 0;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值