Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int b,c,d,e,f,t,i,j,k,l;
- cin>>t;
- for(l=1;l<=t;l++)
- {
- e=0;
- d=0;
- f=0;
- cin>>b;
- int a[b+5];
- a[0]=0;
- for(i=1;i<=b;i++)
- {
- cin>>a[i];
- }
- for(i=1;i<=b;i++)
- {
- c=a[i]-a[i-1];
- if(c>d)
- {
- d=c;
- }
- }
- e=d;
- for(i=1;i<=b;i++)
- {
- f=a[i]-a[i-1];
- if(f==d)
- {
- d--;
- }
- else if(f>d)
- {
- e++;
- break;
- }
- }
- printf("Case %d: %d\n",l,e);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment