Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:36
Show Gist options
  • Save pinglunliao/b7fd170d1cbdda1e994b to your computer and use it in GitHub Desktop.
Save pinglunliao/b7fd170d1cbdda1e994b to your computer and use it in GitHub Desktop.
#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