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

Re:哪位大虾帮我看看我的程序吧,怎么会WA呢?

Posted by 19881110 at 2010-03-29 15:01:45 on Problem 3619
In Reply To:哪位大虾帮我看看我的程序吧,怎么会WA呢? Posted by:ymhd at 2009-03-20 09:10:32
> #include<iostream>
> using namespace std;
> int main()
> {
> 	int n,k;
> 	int s,t,r;
> 	int i,temp,time;
> 	cin>>n>>k;
> 	for(i=0;i<k;i++)
> 	{
> 		time=0;
> 		temp=n;
> 		cin>>s>>t>>r;
> 		if(s*t>=n)
> 		{
> 			time=temp/s;
> 			if(temp%s!=0)
> 				time++;
> 		}
> 		else
> 		{
> 			while(temp>=s*t)
> 			{
> 				time+=t+r;
> 				temp=temp-s*t;
> 			}
> 			time+=temp/s;
> 			if(temp%s!=0)
> 				time++;
> 		}
> 		cout<<time<<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