| 比赛 | 
    20101101 | 
    评测结果 | 
    AAAAAAAWWA | 
    | 题目名称 | 
    漂亮字串 | 
    最终得分 | 
    80 | 
    | 用户昵称 | 
    .Xmz | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2010-11-01 19:21:41 | 
显示代码纯文本
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdio>
using namespace std;
FILE *f1;
int co,cx,mo,mx;
int main()
{
	f1=fopen("bs.in","r");
	freopen("bs.out","w",stdout);
	while (fscanf(f1,"%d%d%d%d",&co,&cx,&mo,&mx)!=EOF)
	{
		if (mo>co) mo=co;if (mx>cx) mx=cx;
		int ans=0;
		if (mo<=0) ans=mx;
		else if (mx<=0) ans=mo;
		else
		{
			if (co<cx) ans=co+min(cx,mx*(co+1));
			else if (cx<co) ans=cx+min(co,mo*(cx+1));
			else ans=co+cx;
		}
		printf("%d\n",ans);
	}
	return 0;
}