5 solutions

  • 0
    @ 2026-7-20 9:42:58
    #include <bits/stdc++.h>
    using namespace std;
    const int N=20;
    int a[N];
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=0;i<1<<n;i++)
    	{
    		for(int j=n-1;j>=0;j--)
    		{
    			if(i>>j&1)
    			{
    				cout<<"Y";
    			}
    			else
    			{
    				cout<<"N";
    			}
    		}
    		cout<<endl;
    	}
    	return 0;
    }

    Information

    ID
    949
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    (None)
    # Submissions
    98
    Accepted
    34
    Uploaded By