fork download
  1. /*
  2.  * https://p...content-available-to-author-only...r.net/problem=1
  3.  */
  4. #include <stdio.h>
  5.  
  6. #define SUMKI(N,K) ((K) * (N) * ((N) + 1) / 2)
  7. #define SUMK(N,K) (SUMKI((((N) - 1) / (K)), (K)))
  8.  
  9. int main(void) {
  10. int n = 1000;
  11. int sum3 = SUMK(n, 3);
  12. int sum5 = SUMK(n, 5);
  13. int sum15 = SUMK(n , 15);
  14.  
  15. printf("%d\n", sum3 + sum5 - sum15);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
233168