Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
谁能帮忙看看我的为什么WA#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator