Submission
Id | When | Author | Problem | Language | CPU | Memory | Verdict |
---|---|---|---|---|---|---|---|
17890 | 2024-04-24 03:53:40 | dnt | Sum Game II | Java | 108 ms | 42624 kb | Accepted |
Test Cases
CPU | Memory | Verdict | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 99 ms | 38552 kb | Accepted | ||||||||
2 | 105 ms | 38612 kb | Accepted | ||||||||
3 | 103 ms | 38504 kb | Accepted | ||||||||
4 | 108 ms | 42236 kb | Accepted | ||||||||
5 | 101 ms | 38472 kb | Accepted | ||||||||
6 | 106 ms | 42624 kb | Accepted | ||||||||
7 | 105 ms | 38960 kb | Accepted | ||||||||
Source Code
program.java
import java.util.Scanner; public class Main { // Read the number of test cases int t = sc.nextInt(); for (int i = 0; i < t; i++) { // Read the number of friends long n = sc.nextLong(); // Calculate the sum of numbers from 0 to n-1 using the arithmetic series formula long sum = (n * (n - 1)) / 2; // Output the sum } } }