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

不知道为什么WA

Posted by heidaizx at 2008-08-09 11:08:53 on Problem 1006
我的代码是:
#include <iostream>
using namespace std;
int main()
{
    int p, e, i, d;
    int n = 0;
    int j = 1;
    while( 1 )
    {
        cin >> p >> e >> i >> d;
        if( p == -1 && e == -1 && i == -1 && d == -1 )
            break;
        n = ( p * 5544 + e * 14421 + i * 1288  + 21252 ) % 21252 - d;
        if(!n)
            n = 21252;
        cout << "Case " << j++ << ": the next triple peak occurs in " << n << " days." << endl;
    }
    return 0;
}

我看了下楼上的那个人的代码,它的代码是
#include <iostream>
using namespace std;
int main()
{
    int p, e, i, d;
    int n = 0;
    int j = 1;
    while( 1 )
    {
        cin >> p >> e >> i >> d;
        if( p == -1 && e == -1 && i == -1 && d == -1 )
            break;
        n = ( p * 5544 + e * 14421 + i * 1288 - d  + 21252 ) % 21252 ;
        if(!n)
            n = 21252;
        cout << "Case " << j++ << ": the next triple peak occurs in " << n << " days." << endl;
    }
    return 0;
}
就一个地方不一样,我测试了下几个重要的数据,都一样的。。不知道我的为什么WA

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