Competitive Programming Solutions

GitHub
back to dashboard

G. Summation from 1 to N

Codeforces - Sheet #1 (Data type - Conditions) · limit: 0.25s · memory: 256MB · view on codeforces

input

2
3
167959139

output

6
14105136270790230
Main.java
static void solve() {

        // Write your solution here
        long n = in.nextLong();
        out.println((n*(n+1))/2);
    }