Skip to content

Commit

Permalink
Merge pull request #1 from harshitakukreja56864/harshitakukreja56864-…
Browse files Browse the repository at this point in the history
…patch-1

Chefandstrings.cpp
  • Loading branch information
harshitakukreja56864 authored Oct 1, 2020
2 parents 9d84311 + 14889d7 commit e0ebcdf
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Chef and strings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <bits/stdc++.h>
using namespace std;


#define ll long long int
#define ull unsigned long long int
#define po2(z) 1<<(ll)z
#define fr(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#define rf(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);--i)
#define modinv(x) powah(x,mod-2)
#define ncr(n,r) (((fact[n]*modinv(fact[n-r]))%mod*modinv(fact[r]))%mod)
#define factorial fact.pb(1);sidha(i,1,MAX)fact.pb((fact[i-1]*i)%mod)
#define TC ll test;cin>>test;while(test--)
#define tej ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod (ll)1000000007
#define MAX 100005
#define Vii vector<ll>
#define pb push_back
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vpii vector<pii >
#define endl '\n'


//--------------------------------------------------//



//--------------------------------------------------//


int main(){
tej;
TC{
ll n;
cin>>n;
ll arr[n];
ll ans=0;
cin>>arr[0];
for(ll i=1;i<n;i++){
cin>>arr[i];
ans+=abs(arr[i]-arr[i-1])-1;
}
cout<<ans<<endl;
}


}

0 comments on commit e0ebcdf

Please sign in to comment.