Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- class anuwta {
- public static void main(String[] args) throws IOException {
- BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
- int t = Integer.parseInt(b.readLine());
- while (t-- > 0) {
- int n = Integer.parseInt(b.readLine());
- long result = calcDistanceYouWalked(n);
- System.out.println(result);
- }
- }
- private static long calcDistanceYouWalked(int n) {
- // TODO Auto-generated method stub
- return (n + 1) * (n + 2) / 2 - 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment