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 |
这也有错?#include<iostream> #include<algorithm> using namespace std; int slove(int b[],int a[] ,int n) { int k; if(n==0) return b[0]; k=0; for(int i=0;i<n-1;i++) { b[k++]=a[i]+a[i+1]; } slove(b,b,k); return b[0]; } int main() { int i,n,total,a[15],b[15]; cin>>n>>total; for(i=0;i<n;i++) a[i]=i+1; do { if(slove(b,a,n)==total) { for(i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl; break; } // system("pause"); } while(next_permutation(a,a+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