📄 2581846_wa.cc
字号:
#include<iostream>
#include<stdio.h>
using namespace std;
typedef struct
{
int c,y;
}node;
int main()
{
int n,s,i;
double com;
scanf("%d %d",&n,&s);
node cost[n];
scanf("%d %d",&cost[0].c,&cost[0].y);
com=cost[0].c*cost[0].y;
for(i=1;i<n;i++)
{
scanf("%d %d",&cost[i].c,&cost[i].y);
if(cost[i].c>cost[i-1].c+s)
cost[i].c=cost[i-1].c+s;
com=com+cost[i].c*cost[i].y;
}
cout<<com<<endl;
system("pause");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -