标签:des style blog http color io os ar for
1 #include<cstdio> 2 inline int read() 3 { 4 int x=0,f=1;char ch=getchar(); 5 while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();} 6 while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();} 7 return x*f; 8 } 9 int n,s,save=100000000; 10 long long ans; 11 int main() 12 { 13 n=read(); 14 s=read(); 15 for (int i=1;i<=n;i++) 16 { 17 int w=read(),c=read(); 18 save+=s; 19 if (save>w)save=w; 20 ans+=(long long)save*c; 21 } 22 printf("%lld",ans); 23 }
BZOJ1680: [Usaco2005 Mar]Yogurt factory
标签:des style blog http color io os ar for
原文地址:http://www.cnblogs.com/zyfzyf/p/3984367.html