题解:P13964 [VKOSHP 2024] Colony of Bacteria
一个很水的签到题,这里先附上打表的数据:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|
| 1 | 8 | 12 | 24 | 24 | 40 | 36 | 56 |
这个表格表示在第
我们很容易发现如果
由此,我们就可以的得到代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
ll n,cnt=1;
cin>>n;
if(n==1)
return cout<<1<<"\n",0;
for(ll i=2;i<=n;i++){
if(i&1)
cnt+=(i/2)*12;
else
cnt+=(i-1)*8;
}
cout<<cnt<<"\n";
return 0;
}