fork download
  1. # include<stdio.h>
  2. int main()
  3. {
  4. long n,m;
  5. scanf("%ld",&n);
  6. scanf("%ld",&m);
  7.  
  8. longlong b[1000];
  9. int j = 0;
  10. int i;
  11. while( n != -1 || m != -1){
  12. longlong a[n];
  13. for( i = 0; i < n; i++){
  14. scanf("%lld",&a[i]);
  15. }
  16. longlong s = 0;
  17. for( i = 0; i < n; i++){
  18. s = s + (a[i]*(n-i)*m);
  19. }
  20.  
  21. b[j] = s;
  22. j++;
  23. scanf("%ld",&n);
  24. scanf("%ld",&m);
  25. }
  26. int k;
  27. for ( k = 0; k < j;k++){
  28.  
  29. printf("%lld\n",b[k]);
  30. }
  31. return 0;
  32. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
10 1000000
99 99 99 99 99 99 99 99 99 99
-1 -1
compilation info
prog.c: In function ‘main’:
prog.c:8: error: ‘longlong’ undeclared (first use in this function)
prog.c:8: error: (Each undeclared identifier is reported only once
prog.c:8: error: for each function it appears in.)
prog.c:8: error: expected ‘;’ before ‘b’
prog.c:12: error: expected ‘;’ before ‘a’
prog.c:14: error: ‘a’ undeclared (first use in this function)
prog.c:16: error: expected ‘;’ before ‘s’
prog.c:18: error: ‘s’ undeclared (first use in this function)
prog.c:21: error: ‘b’ undeclared (first use in this function)
stdout
Standard output is empty