• codeforces 749


    A 给你一个N 让你拆分成 个数最多 和素数的和

    偶数 2 ...  奇数 2... 3

    #include<stdio.h>
    #include<algorithm>
    #include<cstring>
    #include<string>
    #include<cmath>
    #include<vector>
    #include<queue>
    
    using namespace std;
    
    #define LL   __int64
    #define MAXN 510
    #define inf  1000000000
    
    
    
    int main()
    {
        int n;
        scanf("%d",&n);
        if(n%2==0)
        {
            printf("%d
    ",n/2);
            for(int i=1;i<n/2;i++)
                printf("2 ");
            printf("2
    ");
        }
        else
        {
            printf("%d
    ",(n-3)/2+1);
            for(int i=1;i<=(n-3)/2;i++)
                printf("2 ");
            printf("3
    ");
        }
        return 0;
    }
    View Code

    B  给你3个点 让你求第四个点 与前三个点组成平行四边形  3种可能 输出来

    #include<stdio.h>
    #include<algorithm>
    #include<cstring>
    #include<string>
    #include<cmath>
    #include<vector>
    #include<queue>
    
    using namespace std;
    
    #define LL   __int64
    #define MAXN 510
    #define inf  1000000000
    
    
    
    int main()
    {
        int x1,y1,x2,y2,x3,y3;
        scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
        printf("3
    ");
        printf("%d %d
    ",x1+x3-x2,y1+y3-y2);
        printf("%d %d
    ",x2+x1-x3,y2+y1-y3);
        printf("%d %d
    ",x3+x2-x1,y3+y2-y1);
        return 0;
    }
    View Code

    C     D R 吵架 D能举报R R也能举报D

    被举报了 就不能再举报了  问最后是哪边 赢

    模拟一下就行了

    #include<stdio.h>
    #include<algorithm>
    #include<cstring>
    #include<string>
    #include<cmath>
    #include<vector>
    #include<queue>
    
    using namespace std;
    
    #define LL   __int64
    #define MAXN 200010
    #define inf  1000000000
    
    char z[MAXN];
    
    int main()
    {
        int d,r;
        int len;
        int n;
        scanf("%d",&len);
        scanf("%s",z);
        d=r=0;
        int ar,ad;
        ar=ad=0;
        for(int i=0;i<len;i++)
            if(z[i]=='D')
                ad++;
            else
                ar++;
        char an;
        if(ad==0)
        {
            printf("R
    ");
            return 0;
        }
        if(ar==0)
        {
            printf("D
    ");
            return 0;
        }
        while(1)
        {
            for(int i=0;i<len;i++)
            {
                if(z[i]=='D')
                {
                    if(r>0)
                    {
                        r--;
                        ad--;
                        z[i]=' ';
                        if(ad==0)
                        {
                            an='R';
                            break;
                        }
                    }
                    else
                        d++;
                }
                else if(z[i]=='R')
                {
                    if(d>0)
                    {
                         d--;
                         ar--;
                         z[i]=' ';
                         if(ar==0)
                         {
                             an='D';
                             break;
                         }
                    }
                    else
                        r++;
                }
            }
            if(ar==0||ad==0)
                break;
        }
        printf("%c
    ",an);
        return 0;
    }
    View Code
  • 相关阅读:
    Mybatis(二) Mybatis通用的写法
    Mybatis(一)Mybatis相关概念
    NodeJS添加Jquery依赖
    安卓、IOS端AEC密钥加密 Java端密钥解密通用实现(16进制表现形式)
    关于博客园首页及详情页美化的代码
    MD5用户密码加密工具类 MD5Util
    .Net Core跨平台应用研究-CustomSerialPort(增强型跨平台串口类库)
    FtpServer穿透内网访问配置踩坑笔记
    .Net Core之编辑json配置文件
    玩转MQTT-阿里云之MQTT使用(下)
  • 原文地址:https://www.cnblogs.com/cherryMJY/p/6576070.html
Copyright © 2020-2023  润新知