题解:P10862 [HBCPC2024] Spicy or Grilled?
Dream_Moon · · 题解
前言:本蒟蒻的第一篇题解。\
个人感觉这道题最大难点是没有翻译, 之后可能会有。\
如果有翻译这道题就十分简单。\
本蒟蒻是根据数据和提示推理出的公式:
#include<bits/stdc++.h>
using namespace std;
long long n,m,c,d,x; //本蒟蒻怕超就定义了long long
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
ios::sync_with_stdio(0),cin.tie(0);
ios::sync_with_stdio(0),cout.tie(0);//12行到15行可以去掉
cin>>n;
while(n--){//要记的有 T 个数据
cin>>x>>m>>c>>d;//我的变量是不按照题目的变量命名的
cout<<(x-m)*c+m*d<<endl;//输出答案
}
return 0;
}
第一次写题解,若写得不好望指出!