UVa 10812 - Beat the Spread!
2012-11-14 13:52
369 查看
题目:已知 a+b,a-b计算a,b。
分析:简单题。
注意:a+b<a-b || 2a%2{||2b%2} 时不合法 。因为a+b,a-b为整,所以2a,2b同奇偶。
分析:简单题。
注意:a+b<a-b || 2a%2{||2b%2} 时不合法 。因为a+b,a-b为整,所以2a,2b同奇偶。
#include <stdio.h> #include <stdlib.h> int main() { int N,B,S; while ( scanf("%d",&N) != EOF ) while ( N -- ) { scanf("%d%d",&B,&S); if ( B < S || (B+S)%2 ) printf("impossible\n"); else printf("%d %d\n",(B+S)/2,(B-S)/2); } return 0; }
相关文章推荐
- HDU1194 POJ2301 UVA10812 ZOJ2388 Beat the Spread!【数学】
- UVa 10812 - Beat the Spread!
- UVa 10812 Beat the Spread! (陷阱)
- UVa 10812 Beat the Spread!
- UVa 10812 - Beat the Spread!
- 10812 - Beat the Spread!
- 10812 - Beat the Spread!
- [结题报告]10812 - Beat the Spread! Time limit: 3.000 seconds
- HDU 1194 Beat the Spread!(数学)
- 杭电 OJ 1194 Beat the Spread!
- zoj2388----------------Beat the Spread!
- Beat the Spread!
- 1194:Beat the Spread!
- TOJ 1457. Beat the Spread!
- 杭电ACM1194——Beat the Spread!
- 2388_Beat the Spread!(知道两数和差,求两数)
- HDU1194_Beat the Spread!
- 杭电 1194 Beat the Spread!
- Beat the Spread!
- HDOJ 1194 Beat the Spread!