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

少见的1A,纪念一下,附垃圾代码

Posted by cxlm at 2018-01-19 10:39:33 on Problem 3619
#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:
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