比赛 20140321 评测结果 AAAAAAAAAA
题目名称 行动开始 最终得分 100
用户昵称 digital-T 运行时间 1.773 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2014-03-21 18:59:24
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;
long long n,a,b,change=2000000;
long long ans=0;
bool useA=false;
int main()
{
	freopen("goz.in","r",stdin);
	freopen("goz.out","w",stdout);
	cin>>n;
	long long i;
	for(i=1;i<=n;i++)
	{
		cin>>a>>b;
		change=min(change,b-a);
		ans+=max(a,b);
		if(a>=b)useA=true;
	}
	if(useA)cout<<ans<<endl;
	else
	{
		ans-=change;
		cout<<ans;
	}
	return 0;
}