Horje
cses increasing array Code Example
cses increasing array
//
//  main.cpp
//  Increasing Arrays
//
//  Created by Cyril Kevin on 25/05/2021.
//
 
#include <iostream>
using namespace std;
 
int main()
{
    long long n, d = 0, count = 0;
    cin>>n;
    long long a[n];
    for (int i = 0; i<n; i++)
    cin>>a[i];
    for (int i = 0; i<n-1; i++) {
        d = 0;
        if(a[i+1]<a[i])
        {
            d = a[i] - a[i+1];
            a[i+1] = a[i];
            count = count + d;
        }
    }
    cout<<count<<endl;
}
Source: cses.fi




Whatever

Related
;lp; llk, Code Example ;lp; llk, Code Example
shotcut download Code Example shotcut download Code Example
TemplateSyntaxError at /cart/ Code Example TemplateSyntaxError at /cart/ Code Example
how to create array in kothlin Code Example how to create array in kothlin Code Example
boundary value analysis testing Code Example boundary value analysis testing Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8