top1编程
← 返回题目
题解

【入门】s01串

1 条题解

  • 0
    @ 2026-7-29 0:17:46
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        string s="0";
    	int n;
    	cin>>n;
    	while(n--){
    		 string t="";
    		 for(int i=0;i<s.size();i++){
    		 	if(s[i]=='1'){
    		 		t+="01";
    			 }else{
    			 	t+='1';
    			 }
    		 }
             s=t;
    	}
    	cout<<s;
        return 0;
    }
    
    • 1