大厂笔试题
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
552 B

/*第一行输入一个正整数n,代表菜品总数。第二行输入n个正整数ai,代表每道菜的价格。
第三行输入两个正整数x和y,x代表满减的价格,y代表红包的价格。计算订单总价。
输入:
4
10 20 10 20
25 10
输出:
25
*/
#include <iostream>
using namespace std;
int main()
{
int n,a = 0,sum = 0;
int manjian,hongbao;
cin>>n;
for(int i = 0;i < n; i++){
cin>>a;
sum = sum + a;
}
cin>>manjian;
cin>>hongbao;
cout << sum - manjian - hongbao << endl;
return 0;
}