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 |
1207为什么输不出结果啊,帮忙看一下代码 #include<iostream> using namespace std; #include<algorithm> int cmp(int a,int b) { return a<b; } int main() { int i,j,n,k,m,s[10000]; while(cin>>i>>j) { k=0; for(n=i;n<j;n++) { s[k]=1; while(n!=1) { if(n%2==0) n=n/2; else n=3*n+1; s[k]++; } k++; }for(m=0;m<k;k++) sort(s,s+k,cmp); cout<<i<<" "<<j<<" "<<s[k]<<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