版本比较
P17279 『__OI R1』Little Circle
标题
增加 1 行删除 1 行
11cmeufgnycwP17279 『__OI R1』Little Circle正文
增加 26 行删除 11 行
1123434568 行未改动151617182119202122235 行未改动2930313235333435363738394041424543444745464748515249505152535455565758596054556162636465666768697071[题目](https://www.luogu.com.cn/problem/P17279)[题目](https://www.luogu.com.cn/problem/P17279) 一道简单的数学题,很明显需对 $d$ 进行分类讨论:
一道~~难飞了的~~数学题,很明显对 $d$ 分类讨论;
### $d=1$
经过不懈的努力,我推出最优拼法 like this:
8 行未改动### $d=2$
经过不懈的努力,我又推出最优拼法 like this:
 
计算方法:```cpp5 行未改动### $d=3$
经过不懈的努力,我双推出最优拼法 like this:
 
计算方法:```cppif(n==4){cout<<1<<'\n';continue;}cout<<max(n-4,0LL);```
### $d=4$
经过不懈的努力,我没有推出最优拼法,同学方法 like this:经过不懈的努力,~~我没有推出最优拼法~~,同学方法 like this:
 
计算方法:
$n \le 4$ 时输出 $0$ $n > 4$ 时 :先求出$n < 5$ 时直接输出 $0$
$n \ge 5$ 时 : 先求出最大的菱形半径(黄色部分): $r =( \sqrt{2\times n-1}-1) \div 2$ 然后求出红色部分: $h = n - 2 \times r \times r + 2 \times r + 1 $
如果发生了上面第一幅图的情况,也就是$h = 4\times (r+1)$ ,那么就输出 $2 \times r^2 - 2 \times r + 1$ 其他的情况输出 $2 \times r^2 + 2 \times r + 1 + h - \frac{h}{r + 1} - 1$ ```cppif(n==4){cout<<1<<'\n';continue;}cout<<max(n-4,0LL);if(n<5)cout<<"0\n";else{ int r=(int)((sqrt(2.0*n-1)-1)/2); int k=n-(2*r*r+2*r+1); if(k==4*(r+1))cout<<2*r*r-2*r+1; else cout<<2*r*r-2*r+1+k-k/(r+1)-1;}```$d=4$ 的情况我看了[很好的题解](https://www.luogu.com.cn/article/0d38mk0f)才想出来的,他讲的特别好。
代码非(wo)常(tai)简(lan)单(le)就由各位大神去实现了~~~