-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFind_theFine.cpp
More file actions
56 lines (46 loc) · 944 Bytes
/
Copy pathFind_theFine.cpp
File metadata and controls
56 lines (46 loc) · 944 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
53
54
55
56
#include<bits/stdc++.h>
using namespace std;
int CollectFine(int *crr, int *frr, int n, int date)
{
int i, fine=0;
if(date % 2 == 0)
{
for(i=0; i<n; i++)
{
if(crr[i] % 2 != 0)
fine = fine+frr[i];
}
}
else
{
for(i=0; i<n; i++)
{
if(crr[i] % 2 == 0)
fine = fine+frr[i];
}
}
return fine;
}
int main()
{
int t;
cout<<"\nEnter the testcases: ";
cin>>t;
while(t)
{
int n, date, i;
cout<<"\nEnter the Size and Date: ";
cin>>n>>date;
int crr[n], frr[n];
cout<<"Enter the Cars: ";
for(i=0; i<n; i++)
cin>>crr[i];
cout<<"Enter the Fine: ";
for(i=0; i<n; i++)
cin>>frr[i];
int fine = CollectFine(crr, frr, n, date);
cout<<"Total Fine is: "<<fine<<"\n";
t--;
}
return 0;
}