-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathcarvans.cpp
More file actions
48 lines (41 loc) · 744 Bytes
/
Copy pathcarvans.cpp
File metadata and controls
48 lines (41 loc) · 744 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
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
int counter;
int n;
void solve_test()
{
scanf("%d", &n);
if (n == 1)
{
printf("1\n");
return;
}
else
{
vector<int>s;
int speed;
for (int i = 0; i < n; i++)
{
scanf("%d", &speed);
s.push_back(speed);
}
counter = 0;
for (int i = 0; i < n - 1; i++)
{
if (s[i] > s[i + 1])
counter++;
}
printf("%d\n", counter);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
scanf("%d", &t);
for (int i = 0; i < t; i++)
solve_test();
return 0;
}