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. Delphi Sysem.JSON 链式写法

    链式写法有很多优点:连贯.语意集中.简洁.一气呵成.可读性强.比如要把 3.1415926 中的 59 提取为一个整数:Pi.ToString().Substring(5,2).ToInteger() ...

  2. pychram 中 Terminal 中 git log 中文乱码解决办法

    添加环境变量 set LESSCHARSET=utf-8 执行以下命令 git config --global core.quotepath false 不成功执行以下命令 git config -- ...

  3. flask框架(一)——初识Flask

    一.初识flask 1.什么是Flask:Flask是一个python编写的web框架,只是一个内核,默认依赖2个外部库:jinja2模板引擎和WSGI工具集--Werkzeug. 2.安装flask ...

  4. Go语言( 运算符)

    运算符用于在程序运行时执行数学或逻辑运算. 运算符 Go 语言内置的运算符有: 算术运算符 关系运算符 逻辑运算符 位运算符 赋值运算符 算数运算符 运算符 描述 + 相加 - 相减 * 相乘 / 相 ...

  5. exit status 1

  6. 1. Spark SQL概述

    1.1 什么是Spark SQL Spark SQL是Spark用来处理结构化数据的一个模块,它提供了一个编程抽象叫做DataFrame并且作为分布式SQL查询引擎的作用 它是将Hive SQL转换成 ...

  7. Spring Cloud--服务的发布与调用示例

    [Provider] 引依赖: 启动类上添加注解: 配置文件: [Consumer] 引依赖: 加注解: 配置文件: 调用服务: 方式一(动态获取服务列表): Eureka默认30秒拉取一次服务列表. ...

  8. quartz2.3.0(十五)执行、暂停、继续执行、清除,花式操作数据库中持久化的job任务

    #################################################################################################### ...

  9. [POJ3682]King Arthur's Birthday Celebration[期望DP]

    也许更好的阅读体验 \(\mathcal{Description}\) 每天抛一个硬币,硬币正面朝上的几率是p,直到抛出k次正面为止结束,第\(i\)天抛硬币的花费为\(2i-1\),求出抛硬币的天数 ...

  10. Java线程设计模式(五)

    多线程的设计模式:Future模式.Master-Worker模式,生产消费者模式 public interface Data { String getRequest(); } public clas ...