Chri_K

P1082
//思路问题,可以把翻转N-1枚硬币转换为只翻转一枚硬币
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    cout<<n<<endl;//找规律直接输出
    int coin[101];
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(j!=i)
            {
                if(coin[j]==1)
                {
                    coin[j]=0;
                }
                else
                {
                    coin[j]=1;
                }
            }
            cout<<coin[j];
        }
        cout<<endl;
    }
    return 0;
}

posted on 2020-09-09 17:40  Chri_K  阅读(117)  评论(0编辑  收藏  举报