2 条题解

  • -3
    @ 2023-7-21 18:52:08
    #include <iostream>
    using namespace std;
    int n, s;
    long long t = 10100, c, y, ans;
    int main() {
    	freopen("yogurt.in", "r", stdin);
    	freopen("yogurt.out", "w", stdout);
    	scanf("%d%d", &n, &s);
    	for (int i = 0; i < n; i++) {
    		scanf("%lld%lld", &c, &y);
    		t = min(c, t);
    		ans += t * y;
    		t += s;
    	}
    	printf("%lld", ans);
    	return 0;
    }
    
    • -3
      @ 2023-7-21 15:38:53
      #include <bits/stdc++.h>
      using namespace std;
      int main() { 
      	freopen("yogurt.in", "r", stdin); 
      	freopen("yogurt.out", "w", stdout); 
      	long long n,s,c,y,ans = 0,now = 0; 
      	cin >> n >> s; 
      	for(int i = 0;i < n;i ++){ 
      		cin >> c >> y; 
      		now = min(now,c); 
      		ans += now * y; 
      		now += s; 
      	} 
      	cout << ans << endl; 
          return 0;
      } 
      
      • 1

      信息

      ID
      181
      时间
      1000ms
      内存
      256MiB
      难度
      5
      标签
      递交数
      71
      已通过
      29
      上传者