-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JoyHwong
committed
Jan 18, 2016
1 parent
59a7696
commit 3071c4b
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package begin2; | ||
|
||
import java.util.Scanner; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
|
||
Scanner in = new Scanner(System.in); | ||
long n = in.nextLong(); | ||
in.close(); | ||
|
||
// Gauss sum. | ||
System.out.println((1 + n) * n / 2); | ||
} | ||
|
||
} |