Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:36
#include <iostream>
using namespace std;
int main()
{
int n;
while( cin >> n )
{
n = 2 + (n-1)*(2 + 2 * (n - 1))/2;
cout << n << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment