zoukankan      html  css  js  c++  java
  • Codeforces Round #492 (Div. 2)

    A.

    /*
    从大往小依次除
    */
    
    #include<cstdio>
    #include<algorithm>
    #include<cstring>
    #include<iostream>
    #include<set>
    #include<map>
    #define M
    #define ll long long
    
    using namespace std;
    int read() {
        int nm = 0, f = 1;
        char c = getchar();
        for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
        for(; isdigit(c); c = getchar()) nm = nm * 10 + c - '0';
        return nm * f;
    }
    int main() {
        int n = read(), ans = 0;
        ans += n / 100;
        n %= 100;
        ans += n / 20;
        n %= 20;
        ans += n / 10;
        n %= 10;
        ans += n / 5;
        n %= 5;
        ans += n;
        cout << ans;
    
        return 0;
    }

    B.

    /*
    发现每个路口何时进去是能算出来的   所以O1扫一遍即可 
    
    
    */
    
    
    #include<cstdio>
    #include<algorithm>
    #include<cstring>
    #include<iostream>
    #include<set>
    #include<map>
    #define M 100010 
    #define ll long long
    
    using namespace std;
    int read() {
        int nm = 0, f = 1;
        char c = getchar();
        for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
        for(; isdigit(c); c = getchar()) nm = nm * 10 + c - '0';
        return nm * f;
    }
    
    int note[M]; 
    
    int main() {
        int n = read(), id, minn = 0x3e3e3e3e;
        for(int i = 1; i <= n; i++)
        {
            note[i] = read();
            int op = note[i] - i + 1;
            int zz = (op + n - 1) / n;
            if(zz < minn) minn = zz, id = i;
        }
        cout << id;
        return 0;
    }

    C.

    D.

    /*
    贪心的写法  每次 选择最靠左的一个不连续的  将右边的贪心移动过来 
    
    
    
    */
    
    
    #include<cstdio>
    #include<algorithm>
    #include<cstring>
    #include<iostream>
    #include<set>
    #include<map>
    #define M
    #define ll long long
    
    using namespace std;
    int read() {
        int nm = 0, f = 1;
        char c = getchar();
        for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
        for(; isdigit(c); c = getchar()) nm = nm * 10 + c - '0';
        return nm * f;
    }
    
    
    
    int main() {
        
    
    
        return 0;
    }
  • 相关阅读:
    用JS实现汉字转拼音
    jQuery Validate验证框架详解
    移动前端自适应适配布局解决方案和比较
    js获取当前日期时间“yyyy-MM-dd HH:MM:SS”
    jQuery cookie
    dataTable 从服务器获取数据源的两种表现形式
    dataTable 参数说明
    如何在HTML网页中显示HTML标签内容?
    java中构造函数前用public修饰与没有任何修饰符相比,有什么区别?
    面向对象设计
  • 原文地址:https://www.cnblogs.com/luoyibujue/p/9290979.html
Copyright © 2011-2022 走看看