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 cqxhh at 2005-10-16 19:41:39 on Problem 2673
#include<stdio.h>
#define inf 2000000000
int main()
{
    long d[1001],s[1001],i,mint,m,t,x,a[1001],sum;
    while(scanf("%ld %ld",&t,&x)!=EOF)
    {
        scanf("%ld",&m);
        for(i=0;i<m;i++)
        {
            scanf("%ld %ld",d+i,s+i);
            if(d[i]%s[i]!=0)
                a[i]=d[i]/s[i]+1;
            else
                a[i]=d[i]/s[i];
        }
        mint=inf;
        for(i=0;i<m;i++)
        {
            if(mint>a[i])
                mint=a[i];
        }
        if(mint>t)
        {
            sum=t*x;
            printf("%ld\n",sum);
            continue;
        }
        sum=(mint-1)*x;
        t=t-mint+1;
        sum+=t/2*x;
        printf("%ld\n",sum);
    }
    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