测试点正确但是wrong answer
#include
#include
using namespace std;
int main(){
float sum,num,price,key;
char c;
key=0;
sum=0;
while((c=getchar())!=EOF){
while((c=getchar())!='\n'){
if(int(c)==32){
key=1-key;
if(key==1) cin>>num;
if(key==0){
cin>>price;
sum+=num*price;
}
}
}
}
cout<1)<<sum;
return 0;
}
无报错,找不到错误
注意它的提示,不能所有菜的零头加起来,应该是一个菜算完后就四舍五入,而不是全部加完后再四舍五入。