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++内存消耗728k,可我只开了一个三元数组而已,之前用45元素的数组保存结果也没这么大。不知道内存都花在哪了? #include <iostream> using namespace std; int main() { int t,count=0,array[3]; short i,n; cin>>t; while(t--) { array[0]=2; array[1]=3; cin>>n; for(i=2;i<n;i++) { array[i%3]=array[(i-1)%3]+array[(i-2)%3]; } count++; cout<<"Scenario #"<<count<<":"<<endl; cout<<array[(n-1)%3]<<endl; cout<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator