4 solutions

  • 0
    @ 2026-2-25 19:16:51
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=0;i<1<<n;i++)
    	{
    		bitset<32> a(i);
    		for(int j=n-1;j>=0;j--)
    		{
    			if(a[j]==1) cout<<"Y";
    			else cout<<"N"; 
    		}
    		cout<<endl;
    	}
    	return 0;
    }
    
    

    Information

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