Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int t,n,k,i,j,ar[1000],a,sum=0,rem=0,l,count;
- scanf("%d",&t);
- for(i=1;i<=t;i++)
- {
- scanf("%d%d",&n,&k);
- for(j=0;j<n;j++)
- {
- scanf("%d",&ar[j]);
- }
- for(l=0;l<n;l++)
- {
- a=(ar[l]+rem);
- count=a/k;
- rem=a%k;
- if(count>10){ rem=((count-10)*k+rem);count=10;}
- sum=count+sum;
- }
- printf("Case %d: %d\n",i,sum);sum=rem=0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement