zoukankan      html  css  js  c++  java
  • 【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;
    }
  • 相关阅读:
    noi2002银河英雄传说(并查集)
    Ural1076(km算法)
    km算法的个人理解
    函数之装饰器
    函数进阶(一)
    python全栈测试题(一)
    python基础之循环语句
    字符串方法总结
    python基础3
    python基础2
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626232.html
Copyright © 2011-2022 走看看