#include <iostream>
#include <Windows.h>
using namespace std;
int64_t 行数(int64_t n);
int64_t 右上(int64_t n);
int64_t 左上(int64_t n);
int64_t 左下(int64_t n);
int64_t 右下(int64_t n);
int main()
{
DWORD s = GetTickCount();
{
int64_t sum = 1;
for (int64_t i = 2; i <=501; ++i)
{
sum = sum + 右上(i) + 左上(i) + 左下(i) + 右下(i);
}
cout << sum << endl;
}
DWORD e = GetTickCount();
cout << " running time is " << e - s << " ms" << endl;
system("pause");
}
int64_t 行数(int64_t n)
{
return 2 * n - 1;
}
int64_t 右上(int64_t n)
{
return 行数(n)*行数(n);
}
int64_t 左上(int64_t n)
{
return 右上(n) - (行数(n) - 2)-1;
}
int64_t 左下(int64_t n)
{
return 左上(n) - (行数(n) - 2) - 1;
}
int64_t 右下(int64_t n)
{
return 左下(n) - (行数(n) - 2) - 1;
}