4 条题解

  • 1
    @ 2023-5-27 11:29:02

    高精度的!!!

    #include
    using namespace std;
    int a[10000];
    
    int zf(int n) {
    	a[0] = 1;
    	for (int j = 0; j < n; j++) {
    		int x = 0;
    		for (int i = 0; i < 2000; i++) {
    			a[i] = a[i] * 2 + x;
    			x = a[i] / 10;
    			a[i] = a[i] % 10;
    		}
    	}
    	int x = 0;
    	for (int i = 0; i < 2000; i++) {
    		if (a[i] == 0 && a[i - 1] == 0 && a[i - 2] == 0) {
    			x = i;
    			break;
    		}
    	}
    	x -= 3;
    	a[0]--;
    	for (int i = x; i >= 0; i--) {
    		cout << a[i];
    	}
    	return 1;
    }
    
    int main() {
    	int n;
    	cin >> n;
    	zf(n);
    	return 0;
    }
    
    • -1
      @ 2023-6-3 11:37:14
      #include<bits/stdc++.h>
      using namespace std;
      int a[10000];
      
      int zf(int n) {
      	a[0] = 1;
      	for (int j = 0; j < n; j++) {
      		int x = 0;
      		for (int i = 0; i < 2000; i++) {
      			a[i] = a[i] * 2 + x;
      			x = a[i] / 10;
      			a[i] = a[i] % 10;
      		}
      	}
      	int x = 0;
      	for (int i = 0; i < 2000; i++) {
      		if (a[i] == 0 && a[i - 1] == 0 && a[i - 2] == 0) {
      			x = i;
      			break;
      		}
      	}
      	x -= 3;
      	a[0]--;
      	for (int i = x; i >= 0; i--) {
      		cout << a[i];
      	}
      	return 1;
      }
      
      int main() {
      	int n;
      	cin >> n;
      	zf(n);
      	return 0;
      }
      
      • -1
        @ 2023-5-26 7:34:20
        #include<bits/stdc++.h>
        using namespace std;
        long long a[101],n;
        int main(){
        	cin>>n;
        	a[1]=1;
        	a[2]=3;
        	for(int i=1;i<=n;i++)
        	a[i]=a[i-1]*2+1;
        	cout<<a[n];
        	return 0;
        }
        
        • -3
          @ 2023-5-25 21:06:36
          #include<bits/stdc++.h>
          using namespace std;
          long long s=1;
          long long n;
          int main(){
          	cin>>n;
          	for(int i=1;i<n;i++){
          		s=s*2+1;
          	}
          	cout<<s;
          }
          ///
          ///    	   __  __          __  
          /// 	  / / / /_  ______/ /________ 
          ///      / /_/ / / / / __  / ___/ __ \
          /// 	/ __  / /_/ / /_/ / /  / /_/ /
          ///    /_/ /_/\__, /\__,_/_/   \____/ 
          ///          /____/                   
          ///
          
          • 1

          信息

          ID
          1586
          时间
          1000ms
          内存
          256MiB
          难度
          7
          标签
          递交数
          181
          已通过
          35
          上传者