Advertisement
saira12tabassum19

Untitled

Jul 28th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.  
  5. int t,n,k,i,j,ar[1000],a,sum=0,rem=0,l,count;
  6. scanf("%d",&t);
  7. for(i=1;i<=t;i++)
  8. {
  9. scanf("%d%d",&n,&k);
  10. for(j=0;j<n;j++)
  11. {
  12. scanf("%d",&ar[j]);
  13.  
  14. }
  15. for(l=0;l<n;l++)
  16. {
  17. a=(ar[l]+rem);
  18. count=a/k;
  19. rem=a%k;
  20. if(count>10){ rem=((count-10)*k+rem);count=10;}
  21. sum=count+sum;
  22.  
  23.  
  24. }
  25. printf("Case %d: %d\n",i,sum);sum=rem=0;
  26.  
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement