zoukankan      html  css  js  c++  java
  • Codeforces Round #439 (Div. 2) A B C

    强哉qls,这场div2竟是其出的!!!

    A. The Artful Expedient

    暴力 ^ ,判断是否出现,有大佬根据亦或的性质推出 Karen 必赢,太强啦23333333333333.

    #include <stdio.h>
    #include <stdlib.h>
    #include <cmath>
    #include <string.h>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <vector>
    #include <string>
    #include <ctype.h>
    //******************************************************
    #define lrt (rt*2)
    #define rrt  (rt*2+1)
    #define LL long long
    #define inf 0x3f3f3f3f
    #define pi acos(-1.0)
    //***************************************************
    #define eps             1e-8
    #define inf             0x3f3f3f3f
    #define INF             2e18
    #define LL              long long
    #define ULL             unsigned long long
    #define PI              acos(-1.0)
    #define pb              push_back
    #define mk              make_pair
    
    #define all(a)          a.begin(),a.end()
    #define rall(a)         a.rbegin(),a.rend()
    #define SQR(a)          ((a)*(a))
    #define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())
    #define min3(a,b,c)     min(a,min(b,c))
    #define max3(a,b,c)     max(a,max(b,c))
    #define min4(a,b,c,d)   min(min(a,b),min(c,d))
    #define max4(a,b,c,d)   max(max(a,b),max(c,d))
    #define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
    #define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
    #define Iterator(a)     __typeof__(a.begin())
    #define rIterator(a)    __typeof__(a.rbegin())
    #define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
    #define CasePrint       pc('C'); pc('a'); pc('s'); pc('e'); pc(' '); write(qq++,false); pc(':'); pc(' ')
    #define vi              vector <int>
    #define vL              vector <LL>
    #define For(I,A,B)      for(int I = (A); I < (B); ++I)
    #define rFor(I,A,B)     for(int I = (A); I >= (B); --I)
    #define Rep(I,N)        For(I,0,N)
    using namespace std;
    const int maxn=2000+5;
    int a[maxn],b[maxn],c[maxn*maxn];
    int main()
    {
        int n;
        while(cin>>n)
        {
            Rep(i,n)
            {
                cin>>a[i];
                c[a[i]]=1;
            }
            Rep(i,n)
            {
                cin>>b[i];
                c[b[i]]=1;
            }
            int ans=0;
            Rep(i,n)
            {
                Rep(j,n)
                {
                    if( c[ a[i]^b[j]] )  ans++;
                }
            }
            if(ans%2)  puts("Koyomi");
            else puts("Karen");
        }
        return 0;
    }
    View Code

    B - The Eternal Immortality

    查看 m!/n! 最后一位,水题,没啥好讲的

    #include <stdio.h>
    #include <stdlib.h>
    #include <cmath>
    #include <string.h>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <vector>
    #include <string>
    #include <ctype.h>
    //******************************************************
    #define lrt (rt*2)
    #define rrt  (rt*2+1)
    #define LL long long
    #define inf 0x3f3f3f3f
    #define pi acos(-1.0)
    //***************************************************
    #define eps             1e-8
    #define inf             0x3f3f3f3f
    #define INF             2e18
    #define LL              long long
    #define ULL             unsigned long long
    #define PI              acos(-1.0)
    #define pb              push_back
    #define mk              make_pair
    
    #define all(a)          a.begin(),a.end()
    #define rall(a)         a.rbegin(),a.rend()
    #define SQR(a)          ((a)*(a))
    #define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())
    #define min3(a,b,c)     min(a,min(b,c))
    #define max3(a,b,c)     max(a,max(b,c))
    #define min4(a,b,c,d)   min(min(a,b),min(c,d))
    #define max4(a,b,c,d)   max(max(a,b),max(c,d))
    #define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
    #define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
    #define Iterator(a)     __typeof__(a.begin())
    #define rIterator(a)    __typeof__(a.rbegin())
    #define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
    #define CasePrint       pc('C'); pc('a'); pc('s'); pc('e'); pc(' '); write(qq++,false); pc(':'); pc(' ')
    #define vi              vector <int>
    #define vL              vector <LL>
    #define For(I,A,B)      for(int I = (A); I < (B); ++I)
    #define rFor(I,A,B)     for(int I = (A); I >= (B); --I)
    #define Rep(I,N)        For(I,0,N)
    #define REP(I,N)        For(I,1,N+1)
    using namespace std;
    const int maxn=2000+5;
    int main()
    {
        LL a,b;
        while(cin>>a>>b)
        {
            LL sum=1;
            for(LL i=a+1;i<=b;i++)
            {
                if(i%10==0)
                {
                    sum=0;
                    break;
                }
                else
                    sum=sum*i%10;
            }
            cout<<sum<<endl;
        }
        return 0;
    }
    View Code

    C - The Intriguing Obsession

    一道组合数学题,问了初三认识的某数学网友得到的思路23333,用记忆化搜索写的

    #include <stdio.h>
    #include <stdlib.h>
    #include <cmath>
    #include <string.h>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <vector>
    #include <string>
    #include <ctype.h>
    //******************************************************
    #define lrt (rt*2)
    #define rrt  (rt*2+1)
    #define LL long long
    #define inf 0x3f3f3f3f
    #define pi acos(-1.0)
    //***************************************************
    #define eps             1e-8
    #define inf             0x3f3f3f3f
    #define INF             2e18
    #define LL              long long
    #define ULL             unsigned long long
    #define PI              acos(-1.0)
    #define pb              push_back
    #define mk              make_pair
    
    #define all(a)          a.begin(),a.end()
    #define rall(a)         a.rbegin(),a.rend()
    #define SQR(a)          ((a)*(a))
    #define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())
    #define min3(a,b,c)     min(a,min(b,c))
    #define max3(a,b,c)     max(a,max(b,c))
    #define min4(a,b,c,d)   min(min(a,b),min(c,d))
    #define max4(a,b,c,d)   max(max(a,b),max(c,d))
    #define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
    #define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
    #define Iterator(a)     __typeof__(a.begin())
    #define rIterator(a)    __typeof__(a.rbegin())
    #define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
    #define CasePrint       pc('C'); pc('a'); pc('s'); pc('e'); pc(' '); write(qq++,false); pc(':'); pc(' ')
    #define vi              vector <int>
    #define vL              vector <LL>
    #define For(I,A,B)      for(int I = (A); I < (B); ++I)
    #define rFor(I,A,B)     for(int I = (A); I >= (B); --I)
    #define Rep(I,N)        For(I,0,N)
    #define REP(I,N)        For(I,1,N+1)
    using namespace std;
    const int maxn=5000+5;
    #define mod 998244353
    LL dp[maxn][maxn];
    int dir[4][2]= { {1,0},{-1,0},{0,1},{0,-1}  };
    
    int solve(int x,int y)
    {
        if(x==0||y==0)
            return 1;
        if (dp[x][y] == 0)
        {
            dp[x][y]=(y*1ll*solve(x-1,y-1)+solve(x-1,y))%mod;
        }
    
        return dp[x][y];
    }
    
    int main()
    {
        int a,b,c;
        while(cin>>a>>b>>c)
        {
            printf("%I64d
    ",solve(a,b)*1ll*solve(b,c)%mod*solve(a,c)%mod);
        }
    
        return 0;
    }
    View Code
  • 相关阅读:
    第一阶段 开源框架源码模块一:持久层框架设计任务一:自定义持久层01
    【转】Controller中为什么不能写@Transactional
    SFTP上传文件的小工具
    分布式事务 10 TCC的confirm原理、日志原理、网络通信原理
    Hadoop体系概述
    分布式事务08 TCC框架示例——hmily
    分布式事务07 TCC分布式事务与购物下单示例分析
    分布式事务06 三阶段提交与刚性事务的缺陷
    分布式事务05 两阶段事务
    常见环境搭建:MySQL5.7在Windows本地多实例安装
  • 原文地址:https://www.cnblogs.com/weimeiyuer/p/7647674.html
Copyright © 2011-2022 走看看