自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(100)
  • 收藏
  • 关注

原创 第八届“图灵杯”NEUQ-ACM程序设计竞赛个人赛非官方题解

持续更新中…7-2 小宝的幸运数组对于小宝来说,如果一个数组的总和能够整除他的幸运数字k,就是他的幸运数组,而其他数组小宝都很讨厌。现在有一个长度为n的数组,小宝想知道这个数组的子数组中,最长的幸运子数组有多长。对于子数组的定义,如果可以通过从开头和从结束分别删除若干个(可以为零或全部,前后删除个数不必相同)元素来从数组b获得数组a,则称数组a是数组b的子数组。(子数组包含原数组,但不包含空串)输入格式:多组输入。第一行包含一个整数T(1≤T≤10),表示有T组测试数据。每组测试数据包含两行,

2021-01-31 14:12:46 3027 13

原创 巴什博弈+威佐夫博弈

1、巴什博弈(Bash Game)只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个。 最后取光者胜若n%(m+1)==0,后手必胜,反之,先手必胜。 最后取光着输当m=(m+1)*k +1时 ,后手必胜,否则先手必胜。...

2021-01-23 23:42:40 1523

原创 【无标题】

#include <stdio.h> #include <string.h> #include <windows.h> #include <sql.h> #include <sqlext.h> #include <sqltypes.h> #include <odbcss.h>int main(){ SQLRETURN ret; SQLHENV henv;//环境句柄,获得

2022-04-12 00:33:35 226

原创 2021牛客暑期多校训练营2

2021牛客暑期多校训练营2Draw Grids#include <iostream>using namespace std;int n, m;int main(){ cin >> n >> m; if (n*m%2==1) cout<<"NO\n"; else cout<<"YES\n"; return 0;}Er Ba Game#include <bits/stdc++.h>us

2021-07-22 16:44:50 188

原创 2021牛客暑期多校训练营1

D Determine the Photo Position签到题,很简单的模拟题#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(){ int n,m;cin>>n>>m; ll ans=0; for(int i=1;i<=n;i++) { string s;cin>>s; ll c

2021-07-17 21:48:19 255

原创 AcWing 827. 双链表

#include<iostream>using namespace std;const int N = 1e5 + 10;int m;int e[N], l[N], r[N];int idx;//! 初始化void init(){ l[1] = 0, r[0] = 1;//* 初始化 第一个点的右边是 1 第二个点的左边是 0 idx = 2;//! idx 此时已经用掉两个点了}//* 在第 K 个点右边插入一个 X void add(in

2021-07-13 15:04:05 89

原创 acwing 每日一题·暑假 3761. 唯一最小数

给定一个长度为 n 的整数数组 a1,a2,…,an。请你找到数组中只出现过一次的数当中最小的那个数。输出找到的数的索引编号。a1 的索引编号为 1,a2 的索引编号为 2,…,an 的索引编号为 n。 输入格式第一行包含整数 T ,表示共有 T组测试数据。每组数据第一行包含整数 n。第二行包含 n 个整数 a1,a2,…,an。 输出格式每组数据输出一行结果,即满足条件的数的索引编号,如果不存在满足条件的数,则输出 −1。 数据范围1≤T≤2×104 , 1≤n≤2×105,.

2021-07-09 10:34:10 128

原创 2021 ICPC新疆省赛 J - do NOT a=2b (动态规划)

NEVER,NEVER,NEVER have a=2bin an array!You have an array P , and each element is denoted as p1,p2…pn. Nowyou can take any two numbers a and b from it. If a=2×bis satisfied, this array is a “bad array”.Now you need to delete some elements from this ar.

2021-07-07 21:13:44 922 3

原创 2021 ICPC新疆省赛 I - chino with mates ( 二分)

Chino held a blind date event, there are n male guests and m femaleguests attending.The personality characteristic value of each person can be representedby an integer, the personality characteristic value of the i-th maleguest is ai , and the persona.

2021-07-07 21:11:38 476

原创 2021 ICPC新疆省赛 F - chino with ball (思维)

There are N small balls with same weight in horizontal smooth plane.And the volume of these balls can be negligible. All the balls are onthe same straight line. There are three possibilities for theirinitial speed v0which is -1 m/s, 0 m/s and 1 m/s.T.

2021-07-07 21:09:23 314

原创 2021 ICPC新疆省赛 E - is the order a rabbit ??(思维+模拟+后缀最大值)

In a remote place, there is a rabbits market where rabbits can be bought and sold in every day. The trading rules in this market are asfollows:1.The market is available only in morning and afternoon in one day. And the rabbit transaction price may be di.

2021-07-07 21:06:44 1753

原创 2021 ICPC新疆省赛 G - cocktail with snake (思维+模拟)

The favorite game of Mr.Cocktail is dota2. Serpentine walking is a useful skill to dodge the enemy's attack. Serpentine walking refers tothe path of movement that keeps swing direction like a snake. Supposethe map is a n*m two-dimensional plane. Mr.Coc.

2021-07-07 21:02:38 413

原创 2021 ICPC新疆省赛 K - chino with c language(水题)

In C language, there are two functions for copying arrays, memcpy andmemmove. These two C language functions have a same purpose is copying thecontents of a certain section of memory to a section of memory inunits of bytes.The difference between thes.

2021-07-07 21:00:13 954

原创 P2392 kkksc03考前临时抱佛脚 (DFS)

题目背景kkksc03 的大学生活非常的颓废,平时根本不学习。但是,临近期末考试,他必须要开始抱佛脚,以求不挂科。 题目描述这次期末考试,kkksc03 需要考 444 科。因此要开始刷习题集,每科都有一个习题集,分别有s1,s2,s3,s4s_1,s_2,s_3,s_4s1​,s2​,s3​,s4​道题目,完成每道题目需要一些时间,可能不等(A1,A2,…,As1A_1,A_2,\ldots,A_{s_1}A1​,A2​,…,As1​​,B1,B2,…,Bs2B_1,B_2,\ldots,B_{.

2021-07-06 10:54:40 343 1

原创 Educational Codeforces Round 109 (Rated for Div. 2)D. Armchairs (DP)

There are ???? armchairs, numbered from 1 to ???? from left to right. Somearmchairs are occupied by people (at most one person per armchair),others are not. The number of occupied armchairs is not greater than????2.For some reason, you would like to te

2021-06-09 21:25:28 246

原创 Codeforces Round #719 (Div. 3)B. Ordinary Numbers(我打的不通畅的水题)

Let’s call a positive integer ???? ordinary if in the decimal notationall its digits are the same. For example, 1, 2 and 99 are ordinarynumbers, but 719 and 2021 are not ordinary numbers.For a given number ????, find the number of ordinary numbers among

2021-06-08 21:53:35 268

原创 Codeforces Round #719 (Div. 3)A. Do Not Be Distracted!(我打的不通畅的水题)

Polycarp has 26 tasks. Each task is designated by a capital letter ofthe Latin alphabet.The teacher asked Polycarp to solve tasks in the following way: ifPolycarp began to solve some task, then he must solve it to the end,without being distracted by a.

2021-06-08 21:52:01 183

原创 Codeforces Round #719 (Div. 3)D. Same Differences(思维/公式的变换)

题目You are given an array ???? of ???? integers. Count the number of pairs ofindices (????,????) such that ????<???? and ????????−????????=????−????.Input The first line contains one integer ???? (1≤????≤104). Then ???? testcases follow.The first l

2021-06-08 20:47:42 66

原创 Codeforces Round #724 (Div. 2)A. Omkar and Bad Story(思维)

Omkar has received a message from Anton saying “Your story for problemA is confusing. Just make a formal statement.” Because of this, Omkargives you an array ????=[????1,????2,…,????????] of ???? distinct integers. Anarray ????=[????1,????2,…,????????]

2021-06-07 20:34:05 166

原创 Codeforces Round #724 (Div. 2)C. Diluc and Kaeya(思维)

题目The tycoon of a winery empire in Mondstadt, unmatched in everypossible way. A thinker in the Knights of Favonius with an exoticappearance.This time, the brothers are dealing with a strange piece of woodmarked with their names. This plank of wood ca

2021-06-07 20:32:50 158

原创 按照字典序大小遍历字符串的方法

输出a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co

2021-06-07 20:27:53 142

原创 Codeforces Round #724 (Div. 2) B. Prinzessin der Verurteilung(字符串模拟)

题目I, Fischl, Prinzessin der Verurteilung, descend upon this land by thecall of fate an — Oh, you are also a traveler from another world? Verywell, I grant you permission to travel with me.It is no surprise Fischl speaks with a strange choice of words.

2021-06-07 20:25:12 318

原创 干员测试(优先队列priority_queue)

白桃是手游昨日方舟里新出的一个角色, 她的攻击力为x, 攻击范围为白桃正前方的mmm格, 每次攻击都可以攻击她攻击范围内的所有敌人,但是她的每次攻击都会消耗一定的费用c,且敌人走到第一个格子后不会继续行走。为了简化测试模型, 我们假设一共有n个敌人, 每个敌人的生命值为aia_iai​, 防御力为0,即白桃每次攻击对敌人造成的伤害就是x。n个敌人依次排列, 且每个敌人独立的占据一个格子, 当敌人前方格子为空时, 敌人会前进,无视敌人移动所花费的时间。因为dmy今天的理智已经被榨干了, 他需要万能.

2021-06-03 20:47:59 149

原创 G - String Game(动态规划)***

Clair and Bob play a game.Clair writes a string of lowercase characters, in which Bob sets the puzzle by selecting one of his favorite subsequence as the key word of the game. But Bob was so stupid that he might get some letters wrong.Now Clair wants to k

2021-05-26 18:45:12 141

原创 7-8 估值一亿的AI核心代码 (20 分)(字符串大模拟题)

以上图片来自新浪微博。本题要求你实现一个稍微更值钱一点的 AI 英文问答程序,规则是:无论用户说什么,首先把对方说的话在一行中原样打印出来;消除原文中多余空格:把相邻单词间的多个空格换成 1 个空格,把行首尾的空格全部删掉,把标点符号前面的空格删掉;把原文中所有大写英文字母变成小写,除了 I;把原文中所有独立的 can you、could you 对应地换成 I can、I could—— 这里“独立”是指被空格或标点符号分隔开的单词;把原文中所有独立的 I 和 me 换成 you;把原文中所

2021-04-23 13:26:58 198

原创 字符串总结

string s;isalnum()//判断是否是字母tolower()//转换为小写toupper()//转换成大写s.insert(0,"hello");getchar()//吸收换行

2021-04-23 13:24:52 46

原创 D - Playlist(vector的用法)

Arkady has a playlist that initially consists of n songs, numeratedfrom 1 to n in the order they appear in the playlist. Arkady startslistening to the songs in the playlist one by one, starting from song1. The playlist is cycled, i. e. after listening.

2021-04-16 15:32:16 227 1

原创 1247. 后缀表达式(贪心+思维)

给定 N 个加号、M 个减号以及 N+M+1 个整数 A1,A2,···,AN+M+1,小明想知道在所有由这 N 个加号、M 个减号以及N+M+1个整数凑出的合法的后缀表达式中,结果最大的是哪一个?请你输出这个最大的结果。例如使用 123+− ,则 “23+1−” 这个后缀表达式结果是 4,是最大的。 输入格式第一行包含两个整数 N 和 M。第二行包含 N+M+1 个整数 A1,A2,···,AN+M+1。 输出格式输出一个整数,代表答案。 数据范围0≤N,M≤105 , −109≤.

2021-04-16 15:27:48 90

原创 1238. 日志统计(vector二维数组+双指针用法)

小明维护着一个程序员论坛。现在他收集了一份”点赞”日志,日志共有 N行。其中每一行的格式是:ts id表示在 ts 时刻编号 id的帖子收到一个”赞”。现在小明想统计有哪些帖子曾经是”热帖”。如果一个帖子曾在任意一个长度为 D 的时间段内收到不少于 K个赞,小明就认为这个帖子曾是”热帖”。具体来说,如果存在某个时刻 T 满足该帖在 [T,T+D) 这段时间内(注意是左闭右开区间)收到不少于 K个赞,该帖就曾是”热帖”。给定日志,请你帮助小明统计出所有曾是”热帖”的帖子编号。 输入格式.

2021-04-16 15:25:29 220

原创 1239. 乘积最大(mod及双指针算法)

给定 N 个整数 A1,A2,…AN。请你从中选出 K个数,使其乘积最大。请你求出最大的乘积,由于乘积可能超出整型范围,你只需输出乘积除以 1000000009的余数。注意,如果 X<0 , 我们定义 X 除以 1000000009 的余数是负(−X)除以 1000000009的余数,即:0−((0−x)%1000000009)输入格式第一行包含两个整数 N 和 K。以下 N 行每行一个整数 Ai。 输出格式输出一个整数,表示答案。 数据范围1≤K≤N≤105 , −10.

2021-04-14 21:55:15 149

原创 I - Worker(最小公倍数法或二分答案法)

Avin meets a rich customer today. He will earn 1 million dollars if he can solve a hard problem. There are n warehouses and m workers.Any worker in the i-th warehouse can handle ai orders per day. Thecustomer wonders whether there exists one worker as..

2021-04-14 21:21:35 115

原创 AcWing 788. 逆序对的数量(归并排序的应用)

给定一个长度为 n的整数数列,请你计算数列中的逆序对的数量。逆序对的定义如下:对于数列的第 i 个和第 j 个元素,如果满足 i<j 且 a[i]>a[j],则其为一个逆序对;否则不是。 输入格式第一行包含整数 n,表示数列的长度。第二行包含 n个整数,表示整个数列。 输出格式输出一个整数,表示逆序对的个数。 数据范围1≤n≤100000输入样例:6 2 3 4 5 6 1输出样例:5#include <iostream>using namespa.

2021-04-14 16:00:59 77

原创 787. 归并排序

给定你一个长度为 n的整数数列。请你使用归并排序对这个数列按照从小到大进行排序。并将排好序的数列按顺序输出。 输入格式输入共两行,第一行包含整数 n。第二行包含 n 个整数(所有整数均在 1∼109范围内),表示整个数列。 输出格式输出共一行,包含 n个整数,表示排好序的数列。 数据范围1≤n≤100000输入样例:5 3 1 2 4 5输出样例:1 2 3 4 5模版题 背下来就行#include<iostream>using namespace std;.

2021-04-14 15:51:50 45

原创 G - Traffic(暴力模拟)

Avin is observing the cars at a crossroads. He finds that there are n cars running in the east-west direction with the i-th carpassing the intersection at time ai . There are another m cars runningin the north-south direction with the i-th car passing..

2021-04-13 21:25:10 273

原创 1236. 递增三元组(二分法/前缀和)

给定三个整数数组A=[A1,A2,…AN] , B=[B1,B2,…BN], C=[C1,C2,…CN],请你统计有多少个三元组 (i,j,k)满足:1≤i,j,k≤NAi<Bj<Ck输入格式第一行包含一个整数 N。第二行包含 N 个整数 A1,A2,…AN。第三行包含 N 个整数 B1,B2,…BN。第四行包含 N 个整数 C1,C2,…CN。 输出格式一个整数表示答案。 数据范围1≤N≤105 , 0≤Ai,Bi,Ci≤105输入样例:3 1 1 1.

2021-04-12 14:02:38 158

原创 关于lower_bound( )和upper_bound( )的常见用法

lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的。在从小到大的排序数组中,lower_bound( begin,end,num):从数组的begin位置到end-1位置二分查找第一个大于或等于num的数字,找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。upper_bound( begin,end,num):从数组的begin位置到end-1位置二分查找第一个大于num的数字,找到

2021-04-12 14:00:12 108

原创 鸣人的影分身(分苹果题)(技巧dp)

在火影忍者的世界里,令敌人捉摸不透是非常关键的。我们的主角漩涡鸣人所拥有的一个招数——多重影分身之术——就是一个很好的例子。影分身是由鸣人身体的查克拉能量制造的,使用的查克拉越多,制造出的影分身越强。针对不同的作战情况,鸣人可以选择制造出各种强度的影分身,有的用来佯攻,有的用来发起致命一击。那么问题来了,假设鸣人的查克拉能量为 M ,他影分身的个数最多为 N,那么制造影分身时有多少种不同的分配方法?注意:影分身可以分配0点能量。分配方案不考虑顺序,例如:M=7,N=3,那么 (2,2,.

2021-03-20 18:23:02 205

原创 分组背包问题

有 N 组物品和一个容量是 V的背包。每组物品有若干个,同一组内的物品最多只能选一个。 每件物品的体积是 vij ,价值是 wij,其中 i 是组号,j是组内编号。求解将哪些物品装入背包,可使物品总体积不超过背包容量,且总价值最大。输出最大价值。 输入格式第一行有两个整数 N,V,用空格隔开,分别表示物品组数和背包容量。接下来有 N组数据:每组数据第一行有一个整数 Si,表示第 i 个物品组的物品数量; 每组数据接下来有 Si 行,每行有两个整数 vij,wij,用空格隔开,分别表.

2021-03-20 16:55:20 238

原创 多重背包问题 II(二进制优化)

有 N 种物品和一个容量是 V的背包。第 i 种物品最多有 si 件,每件体积是 vi,价值是 wi。求解将哪些物品装入背包,可使物品体积总和不超过背包容量,且价值总和最大。 输出最大价值。 输入格式第一行两个整数,N,V,用空格隔开,分别表示物品种数和背包容积。接下来有 N 行,每行三个整数 vi,wi,si,用空格隔开,分别表示第 i种物品的体积、价值和数量。 输出格式输出一个整数,表示最大价值。 数据范围0<N≤10000<V≤2000 0<vi,wi,si≤.

2021-03-20 16:19:12 113

原创 多重背包问题 I

有 N 种物品和一个容量是 V的背包。第 i 种物品最多有 si 件,每件体积是 vi,价值是 wi。求解将哪些物品装入背包,可使物品体积总和不超过背包容量,且价值总和最大。 输出最大价值。 输入格式第一行两个整数,N,V,用空格隔开,分别表示物品种数和背包容积。接下来有 N 行,每行三个整数 vi,wi,si,用空格隔开,分别表示第 i种物品的体积、价值和数量。 输出格式输出一个整数,表示最大价值。 数据范围0<N,V≤1000<vi,wi,si≤100输入样例4 .

2021-03-20 15:30:07 94

linux 下载文件1发电

linux 下载文件1发电

2023-03-31

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除