标签:font href 应该 依次 size turn ace include 目标
题意:
1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <queue> 5 #define inc(i,j,k) for(int i=j;i<=k;i++) 6 #define maxn 100010 7 using namespace std; 8 9 inline int read(){ 10 char ch=getchar(); int f=1,x=0; 11 while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1; ch=getchar();} 12 while(ch>=‘0‘&&ch<=‘9‘)x=x*10+ch-‘0‘,ch=getchar(); 13 return f*x; 14 } 15 int n,m,a[maxn],b[maxn]; long long ans; 16 int main(){ 17 n=read(); m=read(); inc(i,1,n)a[i]=read(),b[i]=read(); inc(i,1,n)ans+=abs(a[i]-b[i]); 18 a[++n]=m; b[n]=0; sort(a+1,a+n+1); sort(b+1,b+n+1); inc(i,1,n)ans+=abs(a[i]-b[i]); 19 printf("%lld",ans); return 0; 20 }
20161023
标签:font href 应该 依次 size turn ace include 目标
原文地址:http://www.cnblogs.com/YuanZiming/p/6013222.html