Skip to content

Commit d901f12

Browse files
authored
Create Chiku
1 parent 99dfb6d commit d901f12

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Diff for: Chiku

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <iostream>
2+
#include <algorithm>
3+
using namespace std;
4+
5+
int main() {
6+
int t;
7+
cin>>t;
8+
while(t--) {
9+
int m,x,y,h=0;
10+
cin>>m>>x>>y;
11+
int a[m];
12+
for(int i=0;i<m;i++) {
13+
cin>>a[i];
14+
}
15+
sort(a,a+m);
16+
int s = x*y;
17+
for(int i=0;i<m;i++) {
18+
if(i==0) {
19+
if(a[i]-s > 1) {
20+
h += a[i]-s-1;
21+
}
22+
}
23+
24+
if(i==m-1) {
25+
if(a[i]+s < 100) {
26+
h += 100 - (a[i]+s);
27+
}
28+
}
29+
else {
30+
if(a[i]+s < (a[i+1]-s)) {
31+
h += (a[i+1]-s) - (a[i]+s+1);
32+
}
33+
}
34+
35+
}
36+
37+
cout<<h<<endl;
38+
}
39+
// your code goes here
40+
return 0;
41+
}

0 commit comments

Comments
 (0)