• 生活大爆炸版石头剪刀布


    传送门:https://www.luogu.org/problemnew/show/P1328#sub

    这道题相信大家都会做(

    除了下面贴的代码外,还有个比较聪明的办法就是手动打出vs[i][j]表示加分情况

    #include<cstdio>
    using namespace std;
    int n,na,nb,suma,sumb;
    int a[205],b[205];
    int main()
    {
        scanf("%d%d%d",&n,&na,&nb);
        for(int i = 0;i < na;i++) scanf("%d",&a[i]);
        for(int i = 0;i < nb;i++) scanf("%d",&b[i]);
        for(int i = 0;i < n;i++)
        {
            if(a[i%na] == 0 && b[i%nb] == 1) sumb++;
            else if(a[i%na] == 0 && b[i%nb] == 2) suma++;
            else if(a[i%na] == 0 && b[i%nb] == 3) suma++;
            else if(a[i%na] == 0 && b[i%nb] == 4) sumb++;
            else if(a[i%na] == 1 && b[i%nb] == 2) sumb++;
            else if(a[i%na] == 1 && b[i%nb] == 3) suma++;
            else if(a[i%na] == 1 && b[i%nb] == 4) sumb++;
            else if(a[i%na] == 2 && b[i%nb] == 3) sumb++;
            else if(a[i%na] == 2 && b[i%nb] == 4) suma++;
            else if(a[i%na] == 3 && b[i%nb] == 4) suma++;
            
            else if(a[i%na] == 1 && b[i%nb] == 0) suma++;
            else if(a[i%na] == 2 && b[i%nb] == 0) sumb++;
            else if(a[i%na] == 3 && b[i%nb] == 0) sumb++;
            else if(a[i%na] == 4 && b[i%nb] == 0) suma++;
            else if(a[i%na] == 2 && b[i%nb] == 1) suma++;
            else if(a[i%na] == 3 && b[i%nb] == 1) sumb++;
            else if(a[i%na] == 4 && b[i%nb] == 1) suma++;
            else if(a[i%na] == 3 && b[i%nb] == 2) suma++;
            else if(a[i%na] == 4 && b[i%nb] == 2) sumb++;
            else if(a[i%na] == 4 && b[i%nb] == 3) sumb++;
        }
        printf("%d %d",suma,sumb);
        return 0;
     } 
  • 相关阅读:
    设备驱动开发之缓冲区读写操作
    什么是80Plus
    INF Manufacturer Section
    C++编程获得某台机器的IP地址
    INF DestinationDirs Section
    importlib模块
    django的内置信号
    auth模块(登录验证)
    头像文件的预览
    powerDesiger 常用设置
  • 原文地址:https://www.cnblogs.com/peppa/p/9887781.html
Copyright © 2020-2023  润新知