-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtesting!.cpp
More file actions
59 lines (56 loc) · 1.68 KB
/
testing!.cpp
File metadata and controls
59 lines (56 loc) · 1.68 KB
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
53
54
55
56
57
58
59
#include <bits/stdc++.h>
using namespace std;
int fucn(vector<int> errorscrore, int compP, int compQ) {
int n = errorscrore.size();
sort(errorscore.begin(), errorscore.end(), greater<int>());
int noofprojects = 0, innercount = 0, innercountdummy;
for (int i = 0; i < n; i++)
{
// reduction of individual scores
while (errorscore[i] != 0 && errorscore[i] > (n - 1 - i) * compQ && errorscore[i] >= compP)
{
errorscore[i] -= compP;
innercount++;
noofprojects++;
}
// reduction of compQ scores
for (int k = 0; k < n; k++)
{
if (k != i)
{
innercountdummy = innercount;
while (innercountdummy != 0)
{
if (errorscore[k] != 0 && errorscore[k] > 0)
{
errorscore[k] -= compQ;
}
innercountdummy--;
}
}
}
innercount = 0;
}
for (int k = 0; k < n; k++)
{
if (errorscore[k] > 0)
noofprojects++;
}
return noofprojects;
}
int main()
{
int n, to, all;
vector<int> errorscore;
cout << "Enter the number of empolyee:";
cin >> n;
cout << "\nenter error score of each of the employee";
for (int i = 0; i < n; i++)
cin >> errorscore[i];
cout << "\nEnter the score deduction for individual";
cin >> to;
cout << "\nEnter score deduction for all\n";
cin >> all;
// checking if any projects are left out (by this time it will be less that individual deductions)
cout << "\nMin no of projects=" << noofprojects;
}