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 lcftc at 2004-11-02 23:00:20 on Problem 1341
程序9xxMS,刚好不超时,可是总是WA

#include<iostream>
using namespace std;
int N , a1, a2, a3, M ,s1, s2, s3, e1, e2, e3;
int A[60000],R[50001];
int main(){
    int n,I,j,i,si,ei;
    cin>>n;
    for(I=0;I<n;I++){
        cin>>N>>a1>> a2>> a3>> M >>s1>> s2>> s3>> e1>> e2>> e3;
        int max_j=-1;
        int max_v=-1;
        for(i=0;i<=N;i++){
            A[i]=( ((a1*i)%9973)*i+a2*i+a3)%9973;
        }
        for(i=0;i<=M-1;i++){
            int temp=N/2;
            si=(  ((s1*i)%temp)*i+s2*i+s3  ) % temp;
            ei=si+((  ((e1*i)%temp)*i+e2*i+e3   )%temp);
            int min=A[si];
            for(j=si;j<=ei;j++){
                if(A[j]<min) min=A[j];
            }
            R[i]=min;
        }
        for(i=0;i<=M-1;i++){
            if(R[i]>max_v){
                max_v=R[i];
                max_j=i;
            }    
        }
        cout<<max_j<<endl;   
    }
    return 0;
}

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