ZOJ-3936(Apples and Ideas)
2016-04-25 19:45
323 查看
ZOJ-3936(Apples and Ideas)
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.
My solution:
/*2016.4.21*/
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?
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
My solution:
/*2016.4.21*/
#include <cstdio> #include <cstring> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); printf("%d %d\n%d %d\n", c, b + d, a, b + d); } return 0; }
相关文章推荐
- Android热修复技术链接收集
- [译] 盘点 iOS 开发者必看的 105 个全球最佳博客 - 分享自@开发者头条
- iOS实现TableView中Cell出现时弹出动画
- 使用Unity3D的50个技巧:Unity3D最佳实践
- Android Studio编译报错
- iOS控制屏幕旋转
- Android 项目利用 Android Studio 和 Gradle 打包多版本APK
- Appium实战-开始
- 使用fastlane实现iOS持续集成
- iOS Class Prefix自定义类,文件前缀
- iOS工程里添加C文件造成的编译错误
- Android-OptionMenu选项菜单
- Android Studio更换现名图片导致编译失败
- C#开发微信门户及应用(34)--微信裂变红包
- Android 针对个人开发者的bmob支付
- [Android] ListView中如何让onClick和onItemClick事件共存
- 史上最牛最全android开发知识汇总
- LeeCode-Happy Number
- android自定义View实现图片上传进度显示(仿手机QQ上传效果)
- Android Activity之间跳转出现短暂黑屏的处理方法和intent.setFlags方法中的参数值含义