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 rodster at 2009-02-13 11:58:46 on Problem 2673 and last updated at 2009-02-13 13:50:02
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main()
{
	int t, x, m, i;
	scanf("%d %d", &t, &x);
	int minTime = 1000000000;
	scanf("%d", &m);
	int d, s;
	for(i = 0; i < m; ++i)
	{
		scanf("%d %d", &d, &s);
		if(d % s == 0 && minTime > d / s - 1)//整除的和不能整除的区别对待
			minTime = d / s - 1;
		else if(d % s != 0 && minTime > d / s)
			minTime = d / s;
	}
	if(minTime <= 0)
		printf("0\n");
	else printf("%d\n", (minTime + (t - minTime) / 2)*x);
	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