题解:CF1822C Bun Lover
思路
将巧克力酱分为两部分:边框和内部。边框的长度显而易见是 |
||||
---|---|---|---|---|
长度 | 10 | 17 | 26 |
打表后观察可得,内部的公式为
代码
#include <bits/stdc++.h>
using namespace std;
long long t,n;
signed main()
{
ios::sync_with_stdio(0);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> t;
while(t--)
{
cin >> n;
cout << n * n + 2 * n + 2 << '\n';
}
return 0;
}