您的当前位置:首页正文

P1376 [USACO05MAR]Yogurt factory 机器工厂

2024-06-12 来源:爱站旅游
导读P1376 [USACO05MAR]Yogurt factory 机器工厂

#include<bits/stdc++.h>

using namespace std;

long long ans;

int n, s, c, y;

int main()
{
	cin >> n >> s;
	cin >> c >> y;
	ans = c * y;
	int minn = c;
	for(int i = 1; i < n; i++)
	{
		cin >> c >> y;
		minn = min(minn + s, c);//计算本周最小的花费
		ans += minn * y;	 
	}
	cout << ans << endl;	
	return 0;
}

因篇幅问题不能全部显示,请点此查看更多更全内容