| ||||||||||
| 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 | |||||||||
Re:关键是那个取整的问题,看看我的!In Reply To:Re:关键是那个取整的问题,看看我的! Posted by:ngn999 at 2008-07-25 18:46:30 > #include <stdio.h>
>
> int main(){
> int n, k;
> int i;
> int time;
> int s,t,r;
>
> scanf("%d%d",&n,&k);
> for(i = 1; i <= k;i++){
> time = 0;
> scanf("%d%d%d", &s,&t,&r);
>
> if(n%(s*t) == 0)
> time = n/(s*t) * (t+r) - r;
> else if(n % (s * t) % s != 0)
> time = n / (s*t) * (t+r) + (int)(n%(s*t)/s) + 1;
> else ///刚好为整分的最时候,不能加1!
> time = n / (s*t) * (t+r) + (int)(n%(s*t)/s);
> printf("%d\n",time);
> }
> return 0;
> }
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator