| ||||||||||
| 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 | |||||||||
测试数据10 6
1 10 1
1 1 1
6 6 0
10 1 1
7 7 7
100 100 100
-------------
10 6
1 10 1
10
1 1 1
19
6 6 0
2
10 1 1
1
7 7 7
2
#include<stdio.h>
int main()
{
int n,k;
scanf("%d %d",&n,&k);
while(k--)
{
int s,t,r,i,j;
scanf("%d %d %d",&s,&t,&r);
j=n%(s*t);
if(j==0)
{
i=n/(s*t);
printf("%d\n",i*(t+r)-r);
}
else
{
i=n/(s*t);
int m=0;
while(m*s<j)
++m;
printf("%d\n",i*(t+r)+m);
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator