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