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 |
少见的1A,纪念一下,附垃圾代码#include<iostream> using namespace std; int N; int tim(int s,int t,int r){ int res=0,pag=N,i; while(pag>0){ for(i=0;i<t;i++){ pag-=s;res++; if(pag<=0){break;} } if(i==t){res+=r;}else{break;} } return res; } int main(){ int k,a,b,c,res[1500]; cin>>N>>k; for(int i=0;i<k;i++){ cin>>a>>b>>c; res[i]=tim(a,b,c); } for(int i=0;i<k;i++){ cout<<res[i]<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator