Codeforces Round #439 (Div. 2)

本文分享了参加CF比赛的策略心得,包括ICPC新疆站推迟后的准备时间利用建议,以及错过CCSP报名后的应对策略。重点介绍了两道题目的解题思路:通过异或性质快速解决“The Artful Expedient”问题;并采用直接模拟的方法处理“The Eternal Immortality”题目,巧妙地避免了复杂的预处理。

icpc新疆站推迟了,又有了大量时间进行准备,感觉很不错哦

 

ccsp报名错过了这场cf,后来想virtual participate一下,结果太困,睡着了,半小时ac了两题,估计后面的题也没时间补了,暂时就这样吧

 

A. The Artful Expedient

思路:这题,其实有个小技巧,由于异或的性质,所以每组结果都可以经过交换再次得到,因此结果一定是偶数,即Karen一定赢,那么结果直接输出Karen就好了。

据说这题卡了很多人,各种错误,正确率还不到50%,但如果看出这个性质,直接秒杀

 

/*
Author Owen_Q
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <string>
#include <queue>
#include <stack>

using namespace std;

const int maxn = 1e5+10;

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int temp;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&temp);
        }
        for(int i=0;i<n;i++)
        {
            scanf("%d",&temp);
        }
        printf("Karen\n");
    }
    return 0;
}

 


B. The Eternal Immortality

 

思路:1e18,如此大数,看着就想预处理简化,但各种预处理操作搞着搞着就容易出问题,其实,直接O(1e18)强行模拟就好了,听起来似乎很夸张,但加个剪枝,为0就break,直接ac,有时候就是如此神奇

 

/*
Author Owen_Q
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <string>
#include <queue>
#include <stack>

using namespace std;

const int maxn = 1e5+10;

long long a,b;

int re[10][10];

int main()
{
    while(scanf("%I64d%I64d",&a,&b)!=EOF)
    {
        long long sum = 1;
        for(long long t = a+1LL;t <= b;t++)
        {
            sum = (sum * t) % 10LL;
            if(sum == 0LL)
            {
                break;
            }
        }
        printf("%I64d\n",sum);
        /*for(int i=0;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                int jj = j;
                if(jj<i)
                {
                    jj += 10;
                }
                int sum = 1;
                for(int k=i;k<=jj;k++)
                {
                    sum = (sum * k) % 10;
                }
                re[i][j] = sum;
            }
        }
        for(int i=0;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                printf("%d ",re[i][j]);
            }
            printf("\n");
        }
        //cout << re[3][4]<<endl;
        if(b-a>=10)
        {
            printf("0\n");
        }
        else
        {
            printf("%d\n",re[(int)((a+1)%10)][(int)(b%10)]);
        }*/
    }
    return 0;
}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值