Advertisement
Avdluna

Arquivos

Aug 24th, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.    int n,bits,tam,a=0,b=0,r,c,i;
  7.  
  8.     scanf("%d %d", &n, &bits);
  9.  
  10.     for(i=0 ; i<n ; i++){
  11.  
  12.         scanf("%d", &tam);
  13.  
  14.             a +=tam;
  15.     }
  16.  
  17.         c = a/bits;
  18.  
  19.             if(a%bits != 0){
  20.  
  21.                     b++; }
  22.  
  23.         r = c+b;
  24.  
  25.            printf("%d\n", r);
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement