P7621 [AHOI2021初中组] 超市购物
模拟题,把
题目要求答案舍去小数点后第二位及以后的数字。不能直接保留一位输出,要把打折后的答案乘
代码:
#include <bits/stdc++.h>
using namespace std;
int n;
double ans;
int main() {
scanf("%d",&n);
while(n--){
double a, b;
cin>>a>>b;
ans+=a*b;
}
printf("%.1lf", floor((ans)*0.85*10)/10.0);
return 0;
}