【Codeforces Round #421 (Div. 2) A】Mister B and Book Reading

【题目链接】:http://codeforces.com/contest/820/problem/A

【题意】

每天看书能看v页;
且这个v每天能增加a;
但是v有上限v1;
然后每天还必须往回看t页;
问你最少多少天能看完;
一共有c页;

【题解】

傻逼题.

【Number Of WA

1

【反思】

在处理超过v1的时候没搞好.

【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0)

typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;

LL c,v0,v1,a,l;

void dfs(LL x,LL v,LL day){
    if (x >= c){
        cout << day << endl;
        return;
    }
    x-=l;
    LL temp = min(v1,v + a);
    dfs(x + temp,temp,day+1);
}

int main(){
    //Open();
    Close();
    cin >> c >> v0 >> v1 >> a >> l;
    dfs(v0,v0,1);
    return 0;
}
posted @ 2017-10-04 18:44  AWCXV  阅读(90)  评论(0编辑  收藏  举报