Skip to content

Commit

Permalink
10519 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaveljev committed Oct 19, 2011
1 parent 404ad89 commit f99e0a9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions 10519.java
@@ -0,0 +1,32 @@
import java.io.*;
import java.util.*;
import java.math.*;

class Main
{
void solve()
{
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
BigInteger two = new BigInteger("2");

while (in.hasNext())
{
BigInteger n = in.nextBigInteger();
BigInteger r = n.pow(2);

if (n.compareTo(new BigInteger("0")) == 0) {
System.out.println("1");
} else if (n.compareTo(new BigInteger("1")) == 0) {
System.out.println("2");
} else {
System.out.println(r.subtract(n).add(two).toString());
}
}
}

public static void main(String args[])
{
Main problem = new Main();
problem.solve();
}
}

0 comments on commit f99e0a9

Please sign in to comment.