| ||||||||||
| 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<stdio.h>
int main() {
int n,k,s,t,r,i,a,b,j,l;
scanf("%d%d",&n,&k);
for(i=0;i<k;i++) {
scanf("%d%d%d",&s,&t,&r);
b=0;
if(n%s==0) a=n/s;
else a=n/s+1;
if(a<=t) {
printf("%d\n",a);
continue;
}
else {
b=t+r;
l=n;
l=l-s*t;
j=0;
while(l>0) {
l=l-1*s;
j++;
if(j%t==0&&l>0) j+=r;
}
printf("%d\n",b+j);
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator