Loading...
Submission
Id When Author Problem Language CPU Memory Verdict
19958 2024-05-16 21:17:41 AHAMMED_99 Sum Game II C 0 ms 1536 kb Accepted
Test Cases
CPU Memory Verdict
1 0 ms 1536 kb Accepted
2 0 ms 1532 kb Accepted
3 0 ms 1512 kb Accepted
4 0 ms 1532 kb Accepted
5 0 ms 1508 kb Accepted
6 0 ms 1436 kb Accepted
7 0 ms 1512 kb Accepted
Source Code
program.c
Download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int t;
  5. scanf("%d", &t);
  6.  
  7. while (t--) {
  8. int n;
  9. scanf("%d", &n);
  10.  
  11. long long sum = ((long long)n - 1) * n / 2;
  12. printf("%lld\n", sum);
  13. }
  14.  
  15. return 0;
  16. }
  17.