Codechef Problems: Moneymaking (NUGGET)
Problem Statement:
Solution:
Given,
X : number of nuggets chef has
Y : number of star pieces chef has
5000 : Price of a nugget
9800 : Price of a star piece
to find: how much money chef can earn by selling all items
money earned = price of all nuggets + price of all star pieces
= (X * 5000) + (Y * 9800)
Code Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
cout << (x * 5000) + (y * 9800) << endl;
return 0;
}
Comments
Post a Comment