• Educational CF 84(Div2)


    A

    题意:n是否能被k个不同的正奇数表示。

    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<cmath>
    #include<algorithm>
    #include<string>
    #include<iostream>
    #include<set>
    #include<map>
    #include<stack>
    #include<queue>
    #include<vector>
    #include<sstream>
    typedef long long LL;
    const int INF = 0x3f3f3f3f;
    using namespace std;
    const int MAXN = 50000 + 10;
    const double eps = 1e-8;
    int dcmp(double a, double b){
        if(fabs(a - b) < eps) return 0;
        return a < b ? -1 : 1;
    }
    int main(){
        int T;
        scanf("%d", &T);
        while(T--){
            LL n, k;
            scanf("%lld%lld", &n, &k);
            if(n >= k * k && (n + k) % 2 == 0) printf("YES
    ");
            else printf("NO
    ");
        }
        return 0;
    }
    

    B

    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<cmath>
    #include<algorithm>
    #include<string>
    #include<iostream>
    #include<set>
    #include<map>
    #include<stack>
    #include<queue>
    #include<vector>
    #include<sstream>
    typedef long long LL;
    const int INF = 0x3f3f3f3f;
    using namespace std;
    const int MAXN = 100000 + 10;
    const double eps = 1e-8;
    int dcmp(double a, double b){
        if(fabs(a - b) < eps) return 0;
        return a < b ? -1 : 1;
    }
    int g[MAXN], b[MAXN];
    int main(){
        int T;
        scanf("%d", &T);
        while(T--){
            int n;
            scanf("%d", &n);
            for(int i = 1; i <= n; ++i){
                g[i] = b[i] = 0;
            }
            for(int i = 1; i <= n; ++i){
                int k, x;
                scanf("%d", &k);
                while(k--){
                    scanf("%d", &x);
                    if(!g[i] && !b[x]){
                        g[i] = x;
                        b[x] = i;
                    }
                }
            }
            int ans1 = 0;
            int ans2 = 0;
            for(int i = 1; i <= n; ++i){
                if(!g[i]){
                    ans1 = i;
                    break;
                }
            }
            for(int i = 1; i <= n; ++i){
                if(!b[i]){
                    ans2 = i;
                    break;
                }
            }
            if(ans1){
                printf("IMPROVE
    ");
                printf("%d %d
    ", ans1, ans2);
            }
            else{
                printf("OPTIMAL
    ");
            }
        }
        return 0;
    }
    

    C

    题意:n*m的格子,有k个点,要求每个点都必须经过某个点。每次向某个方向移动,所有点是一起移动的,如果到了边界,则原地不动。问是否能在2mn步内使每个点都经过某个指定的点。

    分析:将k个点都移到左上角,再遍历所有格子。

    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<cmath>
    #include<algorithm>
    #include<string>
    #include<iostream>
    #include<set>
    #include<map>
    #include<stack>
    #include<queue>
    #include<vector>
    #include<sstream>
    typedef long long LL;
    const int INF = 0x3f3f3f3f;
    using namespace std;
    const int MAXN = 50000 + 10;
    const double eps = 1e-8;
    int dcmp(double a, double b){
        if(fabs(a - b) < eps) return 0;
        return a < b ? -1 : 1;
    }
    int main(){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        int x, y;
        for(int i = 0; i < 2 * k; ++i){
            scanf("%d%d", &x, &y);
        }
        printf("%d
    ", (n - 1) + (m - 1) + (m - 1) * n + (n - 1));
        for(int i = 0; i < n - 1; ++i) printf("U");
        for(int i = 0; i < m - 1; ++i) printf("L");
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < m - 1; ++j){
                if(i % 2 == 0) printf("R");
                else printf("L");
            }
            if(i != n - 1) printf("D");
        }
        printf("
    ");
        return 0;
    }
    

      

  • 相关阅读:
    java.lang.ClassFormatError
    记一次油猴脚本开发笔记
    一次Linux服务器空间满的随笔解决记录
    配置文件报错:元素类型 "XXX" 必须后跟属性规范 ">" 或 "/>"
    利用字符编码集对中文长度的不同来判断字符串中有没有中文
    记一次Python爬虫开发经历
    MySQL java连接被拒绝:java.sql.SQLException: Access denied for user 'root'@'****' (using password: YES)
    【ArcObject】 AxTocControl:实现图层可移动
    PostgreSQL 主键自动增长
    【转】ArcObject与ArcEngine的联系与区别
  • 原文地址:https://www.cnblogs.com/tyty-Somnuspoppy/p/12560655.html
Copyright © 2020-2023  润新知