MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Codeforces_problems/CrazyComputer716A/codeforces716A.cpp:7–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace std;
6
7int main() {
8 int n,c; cin >> n >> c;
9 int a[n];
10 int w1 = 0,w2 = 0;
11 for (int i =0; i < n; i++)
12 {
13 cin >> a[i];
14 }
15
16 for (int i = 0; i < n-1; i++)
17 {
18 int diff = a[i+1]-a[i];
19 if (diff <= c)//1 <= 1
20 {
21 w1++;
22 }
23 else if (diff > c)//2 > 1.2 > 1.2 > 1.2 > 1.
24 {
25 w1= 0;//w = 0.
26 }
27 }
28 cout << w1+1;
29return 0;
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected