记录编号 |
101125 |
评测结果 |
AAAAAAAAAA |
题目名称 |
漂亮字串 |
最终得分 |
100 |
用户昵称 |
123457 |
是否通过 |
通过 |
代码语言 |
C |
运行时间 |
0.012 s |
提交时间 |
2014-05-09 21:38:40 |
内存使用 |
42.25 MiB |
显示代码纯文本
#include <stdio.h>
#include <stdlib.h>
long long an[1100200]={0},counto[1100000]={0},countx[1100000]={0},maxo[1100000]={0},maxx[1100000]={0},max,min,longest;
int main(int argc, char *argv[])
{
int i,j;
freopen("bs.in","r",stdin);
freopen("bs.out","w",stdout);
for(i=0;;i++)
{
if(scanf("%lld%lld%lld%lld",&counto[i],&countx[i],&maxo[i],&maxx[i])==EOF) {break;}
if(maxo[i]==0||counto[i]==0)
{if(countx[i]>=maxx[i]) printf("%lld\n",maxx[i]);
else printf("%lld\n",countx[i]);}
else if(maxx[i]==0||countx[i]==0)
{if(counto[i]>=maxo[i]) printf("%lld\n",maxo[i]);
else printf("%lld\n",counto[i]);}
if(maxx[i]!=0&&maxo[i]!=0&&counto[i]!=0&&countx[i]!=0)
{if(counto[i]>countx[i])
{min=countx[i];
max=maxo[i];
longest=counto[i];
}
else
{min=counto[i];
max=maxx[i];
longest=countx[i];
}
if((min+1)*max<longest)
an[i]=(min+1)*max+min;
else
an[i]=min+longest;
printf("%lld\n",an[i]); }
}
//system("PAUSE");
return 0;
}
/**/