-
Notifications
You must be signed in to change notification settings - Fork 342
/
Chiku
41 lines (37 loc) · 803 Bytes
/
Chiku
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
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
int m,x,y,h=0;
cin>>m>>x>>y;
int a[m];
for(int i=0;i<m;i++) {
cin>>a[i];
}
sort(a,a+m);
int s = x*y;
for(int i=0;i<m;i++) {
if(i==0) {
if(a[i]-s > 1) {
h += a[i]-s-1;
}
}
if(i==m-1) {
if(a[i]+s < 100) {
h += 100 - (a[i]+s);
}
}
else {
if(a[i]+s < (a[i+1]-s)) {
h += (a[i+1]-s) - (a[i]+s+1);
}
}
}
cout<<h<<endl;
}
// your code goes here
return 0;
}