Codeforces 1180A. Alex and a Rhombus Solution
Solve in C++:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,n,r;
while(scanf("%d",&n)!=EOF)
{
a=n-1;
r=(n*n)+(a*a);
printf("%d\n",r);
}
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,n,r;
while(scanf("%d",&n)!=EOF)
{
a=n-1;
r=(n*n)+(a*a);
printf("%d\n",r);
}
}
No comments