Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main(i)
- {
- int n,count=0;
- int number[105];
- scanf("%d",&n);
- for(i=0;i<n;i++)scanf("%d",&number[i]);
- if(number[0]>30) printf("30\n");
- else
- {
- count=number[0]+4;
- for(i=1;i<n;i++)
- {
- if(number[i]<=count) count+=5;
- else if(number[i]-count>30) break;
- else if(number[i]>count) count=number[i]+4;
- }
- printf("%d\n",count+31);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement