ZOJ 3936-Apples and Ideas【模拟】(2016浙江省大学生程序设计竞赛)
2016-04-26 19:26
357 查看
Apples and Ideas
Time Limit: 2 Seconds
Memory Limit: 65536 KB
"If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas." - George Bernard Shaw
Now Alice has A apples and B ideas, while Bob has C apples andD ideas, what will they have if they exchange all things?
T indicating the number of test cases. For each test case:
The only line contains four integers A, B, C,D (0 <=
A, B, C, D <= 100) - as the problem described.
[/code]
Time Limit: 2 Seconds
Memory Limit: 65536 KB
"If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas." - George Bernard Shaw
Now Alice has A apples and B ideas, while Bob has C apples andD ideas, what will they have if they exchange all things?
Input
There are multiple test cases. The first line of input contains an integerT indicating the number of test cases. For each test case:
The only line contains four integers A, B, C,D (0 <=
A, B, C, D <= 100) - as the problem described.
Output
For each test case, output two lines. First line contains two integers, indicating the number of Alice's apples and ideas; second line contains two integers, indicating the number of Bob's apples and ideas.Sample Input
4 0 0 5 30 20 25 20 0 20 25 20 15 20 25 25 30
Sample Output
5 30 0 30 20 25 20 25 20 40 20 40 25 55 20 55
解题思路:
区分苹果和思维,苹果只能交换,而主意交换只能是不变或是变多。
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { int ap,b,cp,d; scanf("%d%d%d%d",&ap,&b,&cp,&d); int ans; ans=b+d; printf("%d %d\n",cp,ans); printf("%d %d\n",ap,ans); } return 0; }
[/code]
相关文章推荐
- Android技术知识分享第一弹——SDK中常用命令
- 微信网页获取openId
- Android开发中通过源码彻底理解ListView工作原理
- iOS单元测试GHUnit + OCMock(使用cocoapods版)
- Android框架xUtils简介
- android app 国际化
- Android Service生命周期 Service里面的onStartCommand()方法详解
- 移动端 顶部、底部和内容之间的小技巧 用flex布局来解决
- Android bind service讲解以及跨进程通信
- Android开发艺术探索——第四章View的工作原理
- POJ2385-Apple Catching
- Object-c------类的声明与实现以及注意事项
- [Angular 2] Using ngrx/store and Reducers for Angular 2 Application State
- Android之RadioGroup+ViewPager制作的底部导航栏
- iOS基础:获取资源文件的方法
- android开发步步为营之100:开源项目SlidingUpPanelLayout简单用法
- [原创]Android系统中常用JAVA类源码浅析之HashMap
- iOS开发-你真的会用SDWebImage?(转发)
- swift2.0 学习笔记Three
- 【ZOJ3947 The 13th Zhejiang Provincial Collegiate Programming ContestL】【水题】Very Happy Great BG 简单求和