Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:帮忙看一看那里错了。谢谢!

Posted by qiang at 2003-09-06 14:18:13 on Problem 1006
In Reply To:Re:帮忙看一看那里错了。谢谢! Posted by:qiang at 2003-09-06 14:14:08
    #include<stdio.h> 

    int main() 
    { 
        int p, e, i, d; 
        int j, days, x; 

        scanf( "%d%d%d%d", &p, &e, &i, &d ); 
        j = 0; 
        while( p != -1 || e != -1 || i != -1 || d != -1 ) 
        { 
            j++; 
            for( x = i; ; x += 33 ) 
            { 
                if(x >d && x >= p && x >= e && x >= i && (x-p)%23 == 0 && (x-e)%28 == 0 && (x-i)%33 == 0 ) 
                { 
                    days = x % 21252 ; 
                    break; 
                } 
            } 
			days -= d;
			if(days<=0) days +=21252;
           /* if( x > 21252 ) 
                days = 21252-d; */
            printf( "Case %d: the next triple peak occurs in %d days.\n", j, days ); 
                    scanf( "%d%d%d%d", &p, &e, &i, &d ); 
        } 
    } 
改成这样可以ac,但运行时间要很长,最好直接找出规律

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator