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 Linqiaowudi at 2015-03-29 21:00:32 on Problem 3619
#include<stdio.h>
int main() {
	int n,k,s,t,r,i,a,b,j,l;
	scanf("%d%d",&n,&k);
	for(i=0;i<k;i++) {
		scanf("%d%d%d",&s,&t,&r);
		b=0;
		if(n%s==0) a=n/s;
		else a=n/s+1;
		if(a<=t) {
			printf("%d\n",a);
			continue;
		}
		else {
			b=t+r;
			l=n;
			l=l-s*t;
			j=0;
			while(l>0) {
				l=l-1*s;
				j++;
				if(j%t==0&&l>0) j+=r;
			}
			printf("%d\n",b+j);
		}
	}
	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