Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int modelCount, model, rating, sales;
- cin >> modelCount;
- double totalSales = 0, totalRating = 0;
- for (int i = 0; i < modelCount; i++) {
- cin >> model;
- rating = model % 10;
- sales = model / 10;
- totalRating += rating;
- totalSales +=
- (rating == 2 ? 0 :
- rating == 3 ? 0.5 :
- rating == 4 ? 0.7 :
- rating == 5 ? 0.85 : 1) * sales;
- }
- printf("%.2f\n%.2f\n", totalSales, totalRating / modelCount);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement