题解 CF1173B 【Nauuo and Chess】

StudyingFather

2019-06-08 02:23:17

Solution

**Unofficial Solution to this contest also available in [Studying Father's Blog](https://studyingfather.com/archives/1304).** ------------ 一种构造方式是这样的:将前 $ \left\lfloor\frac n 2\right\rfloor+1 $ 个棋子按编号顺序从左往右放在第一行,剩下的棋子按编号顺序从上往下放在最后一列。(也就是摆成L形) 事实上,一切满足 $ r_i+c_i=i+1 $ 的方案都是可行解。证明可以参考官方题解的思路,这里略去。 ```cpp #include <cstdio> #include <algorithm> using namespace std; struct node { int r,c; }a[1005]; int main() { int n; scanf("%d",&n); a[1].r=a[1].c=1; int mid=n/2+1; printf("%d\n",mid); for(int i=1;i<=mid;i++) printf("1 %d\n",i); for(int i=mid+1;i<=n;i++) printf("%d %d\n",i-mid+1,mid); return 0; } ```