problem details: https://www.urionlinejudge.com.br/judge/en/problems/view/1985
Solution in C++:
#include <iostream>
Solution in C++:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a;double sum=0.0;
cin>>a;
for(int b=1;b<=a;b++){
int c,d;
cin>>c>>d;
if(c==1001){
sum=sum+(d*1.50);
}
else if(c==1002){
sum=sum+(d*2.50);
}
else if(c==1003){
sum=sum+(d*3.50);
}
else if(c==1004){
sum=sum+(d*4.50);
}
else if(c==1005){
sum=sum+(d*5.50);
}
}
cout << fixed<<setprecision(2)<<sum << endl;
return 0;
}
Comments
Post a Comment
Thanks for your message