男生女生配(抽屉原理)
2013-01-29 22:00
232 查看
http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=1470&cid=1142
View Code
总结: 注意细节; 讨论各种可能出现的情况
测试数据如下:
20 5 -1 1 1
20 5 -1 20 1
20 5 1 20 1
21 5 4 20 1
21 5 4 1 0
21 5 4 5 1
21 5 5 5 1
-10 5 4 5 4
10 5 4 3 1
55 4 2 10 1
10 1 11 5 1
1 1 0 0 0
1 1 -1 0 0
0 1 -1 0 0
0 0 0 0 0
/////////////////
20 20
1 20
1 14
-1
0 0
-1
-1
-1
-1
46 46
-1
0 0
0 1
0 0
View Code
#include<stdio.h> int main() { int a, b, c, d, e, x, y; int ming, maxg; while(scanf("%d %d %d %d %d", &a, &b, &c, &d, &e)) { if(a==0&&b==0&&c==0&&d==0&&e==0)break; if(c < 0) ming = 0; else ming = c * b + 1; maxg = d - e; if(e <= 0) x = y = 0; else x = a - maxg; y = a - ming; if(x > y) printf("%d\n",-1); else printf("%d %d\n",x,y); } return 0; }
总结: 注意细节; 讨论各种可能出现的情况
测试数据如下:
20 5 -1 1 1
20 5 -1 20 1
20 5 1 20 1
21 5 4 20 1
21 5 4 1 0
21 5 4 5 1
21 5 5 5 1
-10 5 4 5 4
10 5 4 3 1
55 4 2 10 1
10 1 11 5 1
1 1 0 0 0
1 1 -1 0 0
0 1 -1 0 0
0 0 0 0 0
/////////////////
20 20
1 20
1 14
-1
0 0
-1
-1
-1
-1
46 46
-1
0 0
0 1
0 0
相关文章推荐
- 男生容易误解女生的几个行为(转载)
- 站在男生立场评女生的各种拒绝法
- 转载 女生做完和男生做完…
- 女生宿舍,男生止步!
- 所有男生女生看了都会感动的分手理由(天堂杂志转贴)
- 男生的本质底线(女生也要看看)
- 男生应具备的品质底线(女生选对象时,必参考!)
- 女生最想追的十二种男生
- 23的男生女生都该看.看完你会变一个人
- 一个笑话——郑重提示,女生看一半,男生全看完
- [置顶] 女生应该找一个玩ACM的男生
- 辽宁师大男生求爱被拒纵火 欲与大三女生同归于尽
- 选出男生和女生前三名的信息
- (转)女生应该找一个玩ACM的男生
- 一女生写的"如果我是男生"
- 校园情感琐记:男生和女生甜蜜的十个瞬间
- 男生容易误解女生的几个行为(转载)
- 大学男生误闯女生澡堂(仙剑版)
- 一个女生看了会哭,男生看了会沉默的文章
- 一个女生是怎样在QQ上被男生气死的