标签:mod main test min amp pre nba domino include
Link
人类智慧发现\(1,2\)阶无解。
题目告诉了我们\(3\)阶的答案。
人类智慧手算\(4\sim 7\)阶,每行每列的牌数为\(3\)的答案。
可以发现把两个每行每列牌数为\(x\),阶数分别为\(n,m\)的棋盘按左上-右下接在一起可以得到一个\(n+m\)阶的每行每列牌数为\(x\)的棋盘。
设\(k=n\bmod 4\),那么我们先在右下角搞一块\(k+4\)的棋盘,然后往左上一直接\(4\)的就行了。
#include<string>
#include<iostream>
int n,k;
std::string s[4][7]={{"aacd","bbcd","cdaa","cdbb"},{"aa.ab",".bbab","a.cca","a.a.a","bbabb"},{"aacd..","bbcd..","cd..aa","cd..bb","..aacd","..bbcd"},{"aacd...","bbcd...","cd.aa..","cd...bb","..a.baa","..a.b.b","..bbaab"}};
int main()
{
std::cin>>n,k=n&3;
if(n<3) std::cout<<"-1\n";
else if(n==3) std::cout<<"aab\nb.b\nbaa\n";
else for(int i=0;i<n;++i)
{
std::string t(n,'.');
i<n-k-4? t.replace(i/4*4,4,s[0][i%4]):t.replace(n-k-4,k+4,s[k][i-n+k+4]);
std::cout<<t<<'\n';
}
}
标签:mod main test min amp pre nba domino include
原文地址:https://www.cnblogs.com/cjoierShiina-Mashiro/p/12289118.html