| ||||||||||
| 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<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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator