F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_13599901_15825.cpp:1:4: error: stray '#' in program
 01.#include <iostream>   02.using namespace std;  03.  04.int main()  05.{  06.    int a,b,t,i,max;  07.    while(cin >> a >> b)  08.    {  09.        cout << a << " " << b << " ";  10.        if(a>b)//大小不确定   11.        {  12.            t = a;  13.            a = b;  14.            b = t;  15.        }  16.        max = 0;  17.        for(i = a; i<=b; i++)  18.        {  19.            int n = i, sum = 1;  20.            while(n-1)//等于1时就结束   21.            {  22.                if(n%2)  23.                    n = 3*n+1;  24.                else  25.                    n = n/2;  26.                sum++;  27.            }  28.            if(sum>max)  29.            max = sum;  30.        }  31.        cout << max << endl;  32.    }  33.  34.    return 0;  35.}  
    ^
0_0_13599901_15825.cpp:1:1: error: expected unqualified-id before numeric constant
 01.#include <iostream>   02.using namespace std;  03.  04.int main()  05.{  06.    int a,b,t,i,max;  07.    while(cin >> a >> b)  08.    {  09.        cout << a << " " << b << " ";  10.        if(a>b)//大小不确定   11.        {  12.            t = a;  13.            a = b;  14.            b = t;  15.        }  16.        max = 0;  17.        for(i = a; i<=b; i++)  18.        {  19.            int n = i, sum = 1;  20.            while(n-1)//等于1时就结束   21.            {  22.                if(n%2)  23.                    n = 3*n+1;  24.                else  25.                    n = n/2;  26.                sum++;  27.            }  28.            if(sum>max)  29.            max = sum;  30.        }  31.        cout << max << endl;  32.    }  33.  34.    return 0;  35.}  
 ^
0_0_13599901_15825.cpp:1:51: error: expected unqualified-id before numeric constant
 01.#include <iostream>   02.using namespace std;  03.  04.int main()  05.{  06.    int a,b,t,i,max;  07.    while(cin >> a >> b)  08.    {  09.        cout << a << " " << b << " ";  10.        if(a>b)//大小不确定   11.        {  12.            t = a;  13.            a = b;  14.            b = t;  15.        }  16.        max = 0;  17.        for(i = a; i<=b; i++)  18.        {  19.            int n = i, sum = 1;  20.            while(n-1)//等于1时就结束   21.            {  22.                if(n%2)  23.                    n = 3*n+1;  24.                else  25.                    n = n/2;  26.                sum++;  27.            }  28.            if(sum>max)  29.            max = sum;  30.        }  31.        cout << max << endl;  32.    }  33.  34.    return 0;  35.}  
                                                   ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-12-05 07:13:52, Gzip enabled