Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
g++ 超时, c++ 300ms+ 附代码#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; int n; void dfs(int n) { if(n==0) { printf("-"); return ; } dfs(n-1); int i,k=pow(3.0,n-1); for(i=1;i<=k;i++) printf(" "); dfs(n-1); } int main() { // freopen("1.txt","r",stdin); while(scanf("%d",&n)!=EOF) { dfs(n); printf("\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator