-
Notifications
You must be signed in to change notification settings - Fork 27
/
codeforces.cpp
119 lines (92 loc) · 1.77 KB
/
codeforces.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define tc \
int tt; \
cin >> tt; \
while (tt--)
const int N = 1e7 + 10;
int fact[N];
int factorial(int n)
{
fact[0] = fact[1] = 1;
for (int i = 2; i < N; i++)
{
fact[i] = fact[i - 1] * i;
}
return fact[n];
}
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
int lcm(int a, int b)
{
int x = a * b;
int y = gcd(a, b);
return x / y;
}
bool isPer_square(int num)
{
int x = sqrt(num);
return ((x * x) == num);
}
#define rep(i, s, e) for (ll i = s; i < e; i++)
bool isprime(ll x)
{
rep(i, 2, sqrt(x) + 1) if (x % i == 0) return false;
return x != 1;
}
bool isvowel(char ch) { return (ch == 'A') || (ch == 'E') || (ch == 'I') || (ch == 'O') || (ch == 'U'); }
ll powerLL(ll x, ll n)
{
ll result = 1;
while (n)
{
if (n & 1)
result = result * x;
n = n / 2;
x = x * x;
}
return result;
}
void solve()
{
int n;
cin >> n;
vector<int> v(n);
int c=0;
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
for(int i=0;i<n;i++)
{
c= max(v[i]-(i+1),c);
}
cout<<c<<endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// sieve();
int tests = 1;
cin >> tests;
for (int test = 1; test <= tests; test++)
{
//cout << "Case #" << test << ": ";
solve();
}
// solve();
// cerr << "Time : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
return 0;
}