组队_浙江省赛

A.Pokemon Master

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <math.h>

using namespace std;
int n,m;

int main()
{
    int t,i,j,a;
    scanf("%d",&t);
    while(t--)
    {
        int sum1=0,sum2=0;
        scanf("%d%d",&n,&m);
        for(i=0; i<n; i++)
        {
            scanf("%d",&a);
            sum1+=a;
        }
        for(i=0; i<m; i++)
        {
            scanf("%d",&a);
            sum2+=a;
        }
        if(sum1>sum2)
            printf("Calem\n");
        else if(sum1<sum2)
            printf("Serena\n");
        else printf("Draw\n");

    }

    return 0;
}

G.Ternary Calculation

模拟。。。

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <math.h>

using namespace std;
char str1[10],str2[10];
int main()
{
    int t,i,j,d,in,a,b,c;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%s%d%s%d",&a,str1,&b,str2,&c);
        if((str2[0]=='*'||str2[0]=='/'||str2[0]=='%')&&(str1[0]=='+'||str1[0]=='-'))
        {
            d=0;
            in=0;
            if(str2[0]=='*')
                d=b*c;
            else if(str2[0]=='/')
                d=b/c;
            else if(str2[0]=='%')
                d=b%c;
            if(str1[0]=='+')
                in=a+d;
            else if(str1[0]=='-')
                in=a-d;
            printf("%d\n",in);
        }
        else
        {
            d=0;
            if(str1[0]=='+')
                d=a+b;
            else if(str1[0]=='-')
                d=a-b;
            else if(str1[0]=='*')
                d=a*b;
            else if(str1[0]=='/')
                d=a/b;
            else if(str1[0]=='%')
                d=a%b;
            if(str2[0]=='+')
                d+=c;
            else if(str2[0]=='-')
                d-=c;
            else if(str2[0]=='%')
                d%=c;
            else if(str2[0]=='*')
                d*=c;
            else if(str2[0]=='/')
            d/=c;

            printf("%d\n",d);
        }
    }
    return 0;
}

J.What day is that day?

找规律。。。赛上wz一直在找,出了好多错,结果比赛结束也没A。赛后不甘心,自己找了一下,循环节是294.。。。

    #include <iostream>
    #include <stdio.h>
    #include <string.h>


    using namespace std;
    int n[300];
    int main()
    {
        int sum=0,i,j,num;
        for(i=1; i<=294; i++)
        {
            num=1;
            for(j=1; j<=i; j++)
                num=(num*(i%7))%7;
            sum+=num%7;
            n[i]=sum%7;
        }
        n[0]=n[294];
        int t,m;
        scanf("%d",&t);
        while(t--)
        {
            scanf("%d",&m);
            switch(n[m%294])
            {
            case 0:
            {
                printf("Saturday\n");
            }
            break;
            case 1:
            {
                printf("Sunday\n");
            }
            break;
            case 2:
            {
                printf("Monday\n");
            }
            break;
            case 3:
            {
                printf("Tuesday\n");
            }
            break;
            case 4:
            {
                printf("Wednesday\n");
            }
            break;
            case 5:
            {
                printf("Thursday\n");
            }
            break;
            case 6:
            {
                printf("Friday\n");
            }
            break;

            }
        }
        return 0;
    }


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值