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

3619

Posted by simagholizade at 2012-04-18 23:45:17 on Problem 3619
#include<iostream.h>
#include<conio.h>

int main( ){
int n,k,i,*s,*t,*r,*time,*t2;
s=new int[k];
t=new int[k];
r=new int[k];
time=new int[k];
t2=new int[k];
cin>>n>>k;
for(i=0,i<k,i++)
cin>>s[i]>>t[i]>>r[i];
for(i=0,i<k,i++){
time[i]=n/s[i];
if(n%s[i]==0){
t2[i]=time[i]/t[i];
if(time[i]%t[i]==0)
time[i]=t2[i]*t[i]+t2[i]*r[i]-r[i[;
else
time[i]=t2[i]*t[i]+t2[i]*r[i]+time[i]%t[i];}
else{
time[i]+=1;
t2[i]=time[i]/t[i];
if (time [i]%t[i]==0)
time[i]=t2[i]*t[i]+t2[i]*r[i]-r[i];
else
time[i]=t2[i]*t[i]+t2[i]*r[i]+time%t[i];
}
cout<<time[i]<<"\n";}
get ch( );
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