利用了栈

EUCLID  •  1个月前


#include<bits/stdc++.h>
#define LL long long
using namespace std;
stack<LL>stk;
int main(){
	int n;
	cin>>n;
	stk.push(2);
	for(int i=1;i<n;i++){
		stk.push(2*stk.top());
	}
	do{
		cout<<stk.top()<<endl;
		stk.pop();
	}while(!stk.empty());
	return 0;
}

评论: