A.Cat

题库链接
给定区间[l,r],求一个最长子区间,使得区间异或和小于等于s,(结论)偶数和偶数后三个数的异或和等于0

#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define cin(a) scanf("%d",&a)
#define pii pair<int,int>
#define ll long long
#define lll __int128
#define gcd __gcd

ll a[10];

int main()
{
#ifdef ONLINE_JUDGE
#else
    freopen("data.in", "r", stdin);
    freopen("data.out", "w", stdout);
#endif
    int t,cnt;
    cin(t);
    ll l,r,s;
    while(t--)
    {
        cnt = 0;
        scanf("%lld%lld%lld",&l,&r,&s);
        ll ans = 0;
        if(r - l >= 4)
        {
            if(l%2)
            {
                a[cnt] = l;
                cnt++,l++;
            }
            ll len = r-l+1;
            len = len-(len%4);
            ans = len;
            l = l+len;
        }

        for(ll i = l; i <= r; i++) a[cnt++] = i;

        ll mx = 0;
        for(int i = 0; i < cnt; i++)
        {
            ll res = 0,sum = 0;
            for(int j = 0; j <= i; j++)
            {
                res ^= a[j];
                sum++;
            }
            if(res <= s && sum > mx) mx = sum;
        }
        for(int i = 0;i < cnt; i++)
        {
            ll res = 0,sum = 0;
            for(int j = 1; j <= i; j++)
            {
                res ^= a[j];
                sum++;
            }
            if(res <= s && sum > mx) mx = sum;
        }
        ans += mx;
        if(ans) printf("%lld\n",ans);
        else puts("-1");
    }
    return 0;
}

参考博客https://blog.csdn.net/qq_43627087/article/details/103437359

C.<3 numbers

题库链接
给定区间[l,r],问区间素数个数是否大于区间长度的三分之一
暴力,区间大于100没必要去找了

#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define cin(a) scanf("%d",&a)
#define pii pair<int,int>
#define ll long long
#define gcd __gcd
const int inf = 0x3f3f3f3f;
const int maxn = 200100;

int judge(int n)
{
    for(int i = 2; i <= sqrt(n); i++)
    {
        if(n%i==0) return 0;
    }
    return 1;
}

int main()
{
    int t;
    cin>>t;
    int l,r;
    while(t--)
    {
        cin>>l>>r;
        if(r-l > 100)
        {
             printf("Yes\n");
        }
        else
        {
            int res = 0;
            for(int i = l;i <= r; i++)
            {
                if(judge(i)) res++;
            }
            int n = (r-l+1);
            if(3*res >= n)  printf("No\n");
            else  printf("Yes\n");
        }
    }
    return 0;
}

F.The Answer to the Ultimate Question of Life, The Universe, and Everything.

题库链接
∣a∣,∣b∣,∣c∣≤5000. a^3 + b^3 + c^3 = x.0 ≤ x ≤ 200,才200暴力打表就行了

#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define cin(a) scanf("%d",&a)
#define pii pair<int,int>
#define ll long long
#define gcd __gcd
const int inf = 0x3f3f3f3f;
const int maxn = 20000;
int n,m,k,t;

int ans[maxn] = {0,-5000,0,5000,1,-5000,1,5000,8,-5000,2,5000,27,-5000,3,5000,64,-5000,4,5000,125,-5000,5,5000,183,-4889,976,4876,181,-4874,974,4861,190,-4812,-593,4815,111,-4793,-2312,4966,161,-4767,-2476,4980,2,-4373,-486,4375,118,-4328,383,4327,87,-4126,-1972,4271,162,-4125,-1417,4180,16,-4114,-588,4118,92,-4052,861,4039,127,-4034,-3881,4988,128,-3989,-726,3997,48,-3950,-1247,3991,54,-3885,-648,3891,160,-3874,-1654,3972,170,-3834,-2149,4047,198,-3752,-1347,3809,153,-3736,-695,3744,83,-3707,1315,3651,155,-3693,-1049,3721,119,-3677,-1673,3789,163,-3423,-2943,4033,91,-3389,-2912,3992,17,-3331,2195,2977,55,-3329,1837,3131,36,-3223,2358,2731,97,-3168,-991,3200,134,-3013,-1766,3203,109,-2948,853,2924,197,-2867,-1606,3026,179,-2839,1503,2691,20,-2816,-741,2833,120,-2804,1219,2725,144,-2746,-2552,3342,62,-2744,-1561,2903,106,-2689,-1165,2760,25,-2683,1839,2357,89,-2514,1953,2036,53,-2370,1518,2141,45,-2369,1709,2025,81,-2368,-1719,2638,147,-2366,1528,2131,70,-2359,824,2325,101,-2327,319,2325,200,-2318,-638,2334,28,-2268,-249,2269,126,-2212,-419,2217,199,-2208,508,2199,154,-2135,-516,2145,26,-2107,237,2106,98,-2101,-1638,2391,78,-2080,-829,2123,116,-1906,-757,1945,187,-1885,-1092,2000,90,-1803,365,1798,100,-1797,-903,1870,189,-1702,-1403,1974,188,-1639,318,1635,129,-1580,-1238,1801,34,-1555,-244,1557,159,-1534,383,1526,88,-1390,-1282,1686,18,-1373,-1276,1671,169,-1354,-1012,1521,135,-1351,-629,1395,171,-1328,891,1178,82,-1317,847,1188,107,-1309,947,1117,80,-1300,-706,1366,60,-1201,-163,1202,177,-1168,-160,1169,108,-1165,-948,1345,35,-1120,-509,1154,136,-1116,816,946,196,-1057,-579,1112,57,-998,361,982,61,-966,668,845,65,-929,403,903,117,-896,-555,962,99,-893,-622,984,43,-823,-307,837,152,-805,486,741,168,-802,-574,890,51,-796,602,659,46,-758,-473,815,137,-758,-428,801,79,-706,-196,711,11,-695,-641,843,56,-672,505,559,10,-650,-353,683,6,-637,-205,644,71,-533,401,443,151,-463,215,447,37,-444,-84,445,72,-432,-104,434,69,-403,134,398,21,-401,-287,445,133,-399,167,389,191,-377,-215,399,150,-367,260,317,174,-335,-170,349,73,-335,-146,344,146,-327,-263,376,15,-265,-262,332,93,-248,-98,253,102,-239,118,229,29,-233,-69,235,9,-216,-52,217,7,-169,44,168,63,-161,102,146,47,-141,49,139,141,-139,104,116,19,-95,47,91,182,-90,-29,91,138,-86,-77,103,164,-66,-59,79,123,-37,-16,38,38,-27,16,25,96,-22,14,20,192,-20,16,16,178,-13,-10,15,115,-12,8,11,12,-11,7,10,24,-10,8,8,145,-8,-7,10,44,-7,-5,8,105,-7,-4,8,142,-7,-3,8,3,-5,4,4,186,-4,5,5,124,-1,0,5,132,-1,2,5,66,1,1,4,inf};
int a[maxn],b[maxn],c[maxn];

int main()
{
#ifdef ONLINE_JUDGE
#else
    freopen("data.in", "r", stdin);
    freopen("data.out", "w", stdout);
#endif
    int i = 0;
    while(ans[i] != inf)
    {
        int temp = ans[i++];
        a[temp] = ans[i++];
        b[temp] = ans[i++];
        c[temp] = ans[i++];
    }
    cin(t);
    while(t--)
    {
        cin(n);
        if(a[n] || b[n] || c[n]) printf("%d %d %d\n",a[n],b[n],c[n]);
        else puts("impossible");
    }
    return 0;
}

2019 icpc 徐州 解题报告的更多相关文章

  1. 2019 ICPC 徐州网络赛 B.so easy (并查集)

    计蒜客链接:https://nanti.jisuanke.com/t/41384 题目大意:给定n个数,从1到n排列,其中有q次操作,操作(1) 删除一个数字 // 操作(2)求这个数字之后第一个没有 ...

  2. 2019 ICPC徐州网络赛 E. XKC's basketball team(二分)

    计蒜客题目链接:https://nanti.jisuanke.com/t/41387 题目大意:给定一组无序序列,从第一个数开始,求最远比这个数大m的数,与这个数之间相隔多少数字?如果没有输出-1,否 ...

  3. 2019.3.14解题报告&补题报告

    A题 题意: 输入r, c,代表r*c的矩阵,接下来一行,是r个数,代表每一行里最大的数:接下来一行,是c个数,代表每一列中的最大数.求所给数据是否冲突. 思路:判断r个数中最大数maxr和c个数中最 ...

  4. 2014 ACM/ICPC 鞍山赛区现场赛 D&amp;I 解题报告

    鞍山现场赛结束了呢-- 我们出的是D+E+I三道题-- 吾辈AC掉的是D和I两道,趁着还记得.先在这里写一写我写的两道水题D&I的解题报告吧^_^. D题的意思呢是说星云内有一堆排成一条直线的 ...

  5. 【LeetCode】236. Lowest Common Ancestor of a Binary Tree 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  6. 【LeetCode】684. Redundant Connection 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 并查集 日期 题目地址:https://leetco ...

  7. 【LeetCode】817. Linked List Components 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  8. 【LeetCode】90. Subsets II 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 递归 回溯法 日期 题目地址:https://leet ...

  9. CH Round #56 - 国庆节欢乐赛解题报告

    最近CH上的比赛很多,在此会全部写出解题报告,与大家交流一下解题方法与技巧. T1 魔幻森林 描述 Cortana来到了一片魔幻森林,这片森林可以被视作一个N*M的矩阵,矩阵中的每个位置上都长着一棵树 ...

随机推荐

  1. 10 IO流(七)——copy方法封装、关闭流方法封装的两种方式以及try...with...resource

    前言 本文将上一节做的代码,对copy方法与关闭流方法进行封装,并使用try...with...resource关闭流. copy方法封装 我们将copy方法封装,使得只需传入两个流,就能将输入流的源 ...

  2. 3. 键值对RDD

    键值对RDD是Spark中许多操作所需要的常见数据类型.除了在基础RDD类中定义的操作之外,Spark为包含键值对类型的RDD提供了一些专有的操作在PairRDDFunctions专门进行了定义.这些 ...

  3. .net core 定时程序

    using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft. ...

  4. C#混音同时录制采集声卡和麦克风话筒

    在项目中,我们可能需要同时录制声卡的声音和麦克风的声音,比如直播间,在线教学.那么如何实现呢?当然是采用SharpCapture!下面开始演示关键代码,您也可以在文末下载全部源码: 设置授权 第一步: ...

  5. js实现图片上传本地预览

    演示地址:https://xibushijie.github.io/static/uploadImg.html <!DOCTYPE> <html> <head> & ...

  6. vue和react之间的区别

    1.Vue和React之间的区别 相同点: Vue和其他框架一样,都有组件开发和虚拟dom 都支持props进行父子组件之间的数据通信 都支持数据驱动视图,不直接操作真实dom 都支持服务器端的 渲染 ...

  7. fastjson源码分析之序列化

    fastJson是很常用的序列化工具,用了这么久一直想底层看一下它的设计,探究一下它序列化和反序列化效率高的秘密.现在从最基础的用法开始,一点点揭开fastJson神秘的面纱.(版本:1.2.50) ...

  8. git小结-ms

    目录 1.git是什么 2.git怎么工作的 3.git常用命令 4.git提效工具 5.git的技术用语 1.git是什么 git是开源的分布式的版本控制系统,可以有效.高速地处理的项目版本管理.g ...

  9. mysql的左连接问题

    之前写过一个mysql语句,功能是将一个表ds的一个字段值同步更新到另一个表bk的字段,不过不是全部,只更新表bk中有的数据,如果表bk中有而表ds中没有,表B对应的这个字段值就为空 UPDATE b ...

  10. Anaconda-Jupyter notebook 如何安装 nbextensions

    系统环境:windows 安装过程中,再次遇到了一地鸡毛,经过不断查询方法,发现前辈大牛们好棒棒! Step1:确定是已经安装好anaconda Step2:要在anaconda prompt模式下运 ...