-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChores.cpp
More file actions
52 lines (44 loc) · 708 Bytes
/
Chores.cpp
File metadata and controls
52 lines (44 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<bits/stdc++.h>
using namespace std;
int maximum(int a[],int n)
{
int max=a[0];
for(int i=0;i<n;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
return max;
}
int main()
{
int test, task,time;
cin>>test>>task>>time;
int arr[test];
for(int i=0;i<test;i++)
{
cin>>arr[i];
}
for(int i=0;i<task;i++)
{
int max_i= maximum(arr,test);
for(int i=0;i<test;i++)
{
if(arr[i]==max_i)
{
arr[i]=0;
break;
}
}
}
int Sum=0;
for(int i=0;i<test;i++)
{
Sum=Sum+arr[i];
}
Sum=Sum+(task*time);
cout<<Sum;
return 0;
}