- 博客(63)
- 资源 (1)
- 收藏
- 关注
原创 Educational Codeforces Round 87 (Rated for Div. 2) C2.Not So Simple Polygon Embedding
Educational Codeforces Round 87 (Rated for Div. 2) C2.Not So Simple Polygon Embedding题目链接The statement of this problem is the same as the statement of problem C1. The only difference is that, in problem C1, n is always even, and in C2, n is always odd.Y
2020-05-27 09:47:23 2377
原创 Codeforces Round #611 (Div. 3) C.Friends and Gifts
Codeforces Round #611 (Div. 3) C.Friends and Gifts题目链接There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself.For each f
2020-05-26 20:56:13 2376
原创 Codeforces Round #579 (Div. 3) E.Boxers
Codeforces Round #579 (Div. 3) E.Boxers题目链接There are n boxers, the weight of the i-th boxer is ai. Each of them can change the weight by no more than 1 before the competition (the weight cannot become equal to zero, that is, it must remain positive). Wei
2020-05-26 17:07:22 2330 1
原创 Codeforces Round #598 (Div. 3) B.Minimize the Permutation
Codeforces Round #598 (Div. 3) B.Minimize the Permutation题目链接You are given a permutation of length n. Recall that the permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but
2020-05-26 16:33:41 2367
原创 Codeforces Round #644 (Div. 3) H.Binary Median
Codeforces Round #644 (Div. 3) H.Binary Median题目链接Consider all binary strings of length m (1≤m≤60). A binary string is a string that consists of the characters 0 and 1 only. For example, 0110 is a binary string, and 012aba is not. Obviously, there are ex
2020-05-26 15:33:17 10886 1
原创 Educational Codeforces Round 81 (Rated for Div. 2) B.Infinite Prefixes
Educational Codeforces Round 81 (Rated for Div. 2) B.Infinite PrefixesYou are given string s of length n consisting of 0-s and 1-s. You build an infinite string t as a concatenation of an infinite number of strings s, or t=ssss… For example, if s= 10010,
2020-05-26 11:40:56 2365
原创 LightOJ 1236 Pairs Forming LCM
LightOJ 1236 Pairs Forming LCMFind the result of the following code:long long pairsFormLCM( int n ) {long long res = 0;for( int i = 1; i <= n; i++ )for( int j = i; j <= n; j++ )if( lcm(i, j) == n ) res++; // lcm means least common multipleretu
2020-05-26 09:50:27 2337
原创 第十五届中北大学算法与程序设计竞赛(公开赛)F.集合操作
第十五届中北大学算法与程序设计竞赛(公开赛)F.集合操作题目链接题目描述有一个集合S,刚开始是空集,现在有3种操作。1.往集合中添加x,如果集合中已经存在x,则不添加。2.从集合中删除x,如果集合中不存在x,则不删除。3.查询大于等于x且不在集合S中的最小的正整数输入描述:第一行输入n,表示有n次操作接下来n行,每行输入两个正整数id和x。id表示执行的操作序号1<=n<=1000000,1<=id<=3,1<=x<=1000 000 000输出描
2020-05-25 16:41:40 2436
原创 第十五届中北大学算法与程序设计竞赛(公开赛)C.港口
第十五届中北大学算法与程序设计竞赛(公开赛)C.港口题目链接题目描述港口有n堆货物,他们的重量分别为w1,w2,…wn,每堆货物的重量不一定相同。吊车师傅每次操作可以使任意第i堆到第j堆的货物都增加一个重量或者减少一个重量。请问吊车师傅最少需要执行几次操作可以使n堆货物重量都相同。输入描述:第一行输入正整数n。第二行输入n个整数,第i个整数表示wi。数据范围:0 < n < 100000;0 <= wi <= 1000000000;输出描述:第一行输出最少操作次
2020-05-25 16:15:40 2461
原创 Codeforces Round #644 (Div. 3) G.A/B Matrix
Codeforces Round #644 (Div. 3) G.A/B Matrix题目链接You are given four positive integers n, m, a, b (1≤b≤n≤50; 1≤a≤m≤50). Find any such rectangular matrix of size n×m that satisfies all of the following conditions:each row of the matrix contains exactly a o
2020-05-25 15:13:51 2368
原创 Codeforces Round #644 (Div. 3) F.Spy-string
Codeforces Round #644 (Div. 3) F.Spy-string题目链接You are given n strings a1,a2,…,an: all of them have the same length m. The strings consist of lowercase English letters.Find any string s of length m such that each of the given n strings differs from s in
2020-05-25 10:59:21 2413
原创 Codeforces Round #644 (Div. 3) E.Polygon
Codeforces Round #644 (Div. 3) E.Polygon题目链接Polygon is not only the best platform for developing problems but also a square matrix with side n, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a canno
2020-05-25 10:48:36 2338
原创 Codeforces Round #644 (Div. 3) D.Buying Shovels
Codeforces Round #644 (Div. 3) D.Buying Shovels题目链接Polycarp wants to buy exactly n shovels. The shop sells packages with shovels. The store has k types of packages: the package of the i-th type consists of exactly i shovels (1≤i≤k). The store has an infi
2020-05-25 10:39:39 2395
原创 第十五届中北大学算法与程序设计竞赛(公开赛)G.数位操作1
第十五届中北大学算法与程序设计竞赛(公开赛)G.数位操作1题目链接题目描述给你一个正整数 n(n<=1010)n (n<=10^{10} )n(n<=1010)找到最小的某个数据 ans (ans >9)要求 ans 的每一数位(个位 十位 百位 千位…) 乘积与 n 相等, 不存在输出-1PS:多组输入,输入直到文件结束输入描述:输入一个小于等于 101010^{10}1010 的数正整数n输出描述:如果可以找到 某个数据 ans 数位乘积与 n 相等 那么便输
2020-05-24 20:47:12 2333
原创 第十五届中北大学算法与程序设计竞赛(公开赛)K.签个到
第十五届中北大学算法与程序设计竞赛(公开赛)K.签个到题目链接题目描述给定 n\ n n 个正整数:a1,a2...an−1,ana_1,a_2...a_{n-1},a_na1,a2...an−1,an ,每次操作可以选择数组中任意一个数加上或减去其下标。(即 ai=ai+ia_i=a_i+iai=ai+i 或 ai=ai−ia_i=a_i-iai=ai−i )求 m\ m m 次操作后,数组中最大值与最小值的差最大可能是多少。(数组下标从1
2020-05-24 20:40:51 2406
原创 2020 年 “游族杯” 全国高校程序设计网络挑战赛 I.Idiotic Suffix Array
2020 年 “游族杯” 全国高校程序设计网络挑战赛 I.Idiotic Suffix Array题目链接简单构造题,我是用 a,b,ca,b,ca,b,c 三个字母构造的,AC代码如下:#include<bits/stdc++.h>using namespace std;typedef long long ll;main(){ int n,k; cin>>n>>k; putchar('b'); for(int i=0;i
2020-05-24 15:12:35 2347
原创 2020 年 “游族杯” 全国高校程序设计网络挑战赛 F.Find / -type f -or -type d
2020 年 “游族杯” 全国高校程序设计网络挑战赛 F.Find / -type f -or -type d题目链接这题其实不难,我们要判断每个字符串是否是其他串的子串即可,对每个字符串,标记它目录下的所有子串即可,最后遍历一遍,如果这个字符串只出现一次且后缀为 .eoj.eoj.eoj 则答案加1,AC代码如下:#include<bits/stdc++.h>using namespace std;typedef long long ll;string s[100005];mai
2020-05-23 19:50:29 2481
原创 西安邮电大学第五届ACM-ICPC校赛(同步赛)G.校车
西安邮电大学第五届ACM-ICPC校赛(同步赛)G.校车题目链接题目描述西安邮电大学有一辆从老校区到新校区的校车,总共有 n 个学生乘坐校车,在 aia_{i}ai 站上车,在 bib_{i}bi 站下车。学校打算去除一部分不必要的站点,请问需要保留多少站点,需要安排多少个座位?输入描述:输入 T 组数据 (1≤T≤10)(1 \le T \le 10)(1≤T≤10)输入 n(1≤n≤105)n(1 \le n \le 10^{5})n(1≤n≤105)输入 n 组 ai,bi(1≤a
2020-05-23 18:22:15 2447
原创 EOJ 2853 集合运算
EOJ 2853 集合运算题目链接今天才发现 STL 有求交并差集的函数,学到了????:#include<bits/stdc++.h>using namespace std;typedef long long ll;int n,m,k;set<int>a,b;vector<int>ans1,ans2,ans3;main(){ cin>>n>>m; for(int i=0;i<n;i++) cin>&
2020-05-20 17:10:55 2278
原创 牛客小白月赛25 D.抽卡
牛客小白月赛25 D.抽卡题目链接题目描述王子连接的国服终于上线啦~已知王子连接的抽卡系统如下:共有 n 个卡池,第 个卡池共有 aia_iai 种卡,每张卡的出货率都是相等的(也就是说该卡池单次抽卡,每种卡出货率是 1/ai1/a_i1/ai。第 i 个卡池中,你有 bib_ibi 种卡是自己很想要的。现在的问题是,如果每个卡池里都单抽一次,能抽到自己想要的卡的概率是多少?可以证明,这个概率一定可以写成 形式的分数。最后输出该分数在模 109+710^9+7109+7意义下的值就可
2020-05-20 16:55:12 2546
原创 牛客小白月赛25 C.白魔法师
牛客小白月赛25 C.白魔法师题目链接题目描述你是一个白魔法师。现在你拿到了一棵树,树上有 个点,每个点被染成了黑色或白色。你可以释放一次魔法,将某个点染成白色。(该点不一定是黑色点,也可以是白色点)现在释放魔法后要保证最大的白色点连通块尽可能大。请求出最大白色连通块的大小。注:所谓白色连通块,指这颗树的某个连通子图,上面的点全部是白色。输入描述:第一行输入一个正整数 n ,代表树的顶点数量。第二行输入一个长度为 n 的、仅由’W’和’B’组成的字符串,第 i 个点为’W’代表该点为白
2020-05-20 16:04:49 2685
原创 牛客小白月赛25 J.异或和之和
牛客小白月赛25 J.异或和之和题目链接题目描述给一个数组,数组内有 个正整数。求这些数任取3个数异或运算后求和的值。也就是说,取一共 Cn3C_{n}^{3}Cn3 个三元组,计算这些三元组内部异或,之后求和。(具体操作可以见样例描述)由于该值可能过大,输出其对 109+710^9+7109+7 取模的值。输入描述:第一行一个正整数 。接下来有 个正整数 aia_iai(1≤ai≤10181≤a_i≤10^{18}1≤ai≤1018)输出描述:任取三个数、三元组内部位异
2020-05-20 11:22:15 2628
原创 牛客小白月赛25 G.解方程
牛客小白月赛25 解方程题目链接题目描述牛能作为一个学霸,非常擅长解方程。有一天,他拿到了一个方程:xa+blnx=cx^a+blnx=cxa+blnx=c牛能当然一下子就解出了这个方程。但他想考考聪明的你,这个方程的解的多少?输入描述:三个正整数 a,b,c输出描述:如果解存在,请输出方程的解x的值,若你和正确答案的误差不超过 10−710^{-7}10−7 ,则认为你的答案正确。如果解不存在,则输出。示例1输入3 5 1输出1.00000000000000很容易观
2020-05-20 10:04:15 2563
原创 AtCoder Beginner Contest 168 E.∙ (Bullet)
AtCoder Beginner Contest 168 E.∙ (Bullet)题目链接明显的数论题,我们假设知道某一对 Ai,BiA_i,B_iAi,Bi 的数量 numnumnum,那么他们可组成的符合条件的对数怎么算?首先在 numnumnum 里面至少要选一对,即从 Cnum1+Cnum2+⋯+Cnumnum=2num−1C_{num}^1+C_{num}^2+\cdots+C_{num}^{num}=2^{num}-1Cnum1+Cnum2+⋯+Cnumnum=2num−1,剩
2020-05-19 10:40:33 2498
原创 AtCoder Beginner Contest 168 C.: (Colon)
AtCoder Beginner Contest 168 C.: (Colon)题目链接这题就是简单几何题,题目的难点就在于求角度,我们知道 hhh 和 mmm,我们可以求出此时两者的角度:分钟所处的角度为 m∗6m*6m∗6小时所处的角度为 h∗30+m/2h*30+m/2h∗30+m/2知道角度后套一个余弦定理即可,AC代码如下:#include<bits/stdc++.h>using namespace std;typedef long long ll;#defin
2020-05-19 10:04:05 2298 1
原创 Educational Codeforces Round 87 (Rated for Div. 2) D.Multiset
Educational Codeforces Round 87 (Rated for Div. 2) D.Multiset题目链接Note that the memory limit is unusual.You are given a multiset consisting of n integers. You have to process queries of two types:add integer k into the multiset;find the k-th order sta
2020-05-18 21:10:41 2467
原创 AtCoder Beginner Contest 168 D... (Double Dots)
AtCoder Beginner Contest 168 D… (Double Dots)题目链接简单图论题,从 111 点 BFS 即可,用 ans[i]ans[i]ans[i] 记录答案,如果距离可以更新就把ans[i]ans[i]ans[i] 置为前一个点即可,注意 DFS 会超时,AC代码如下: #include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=1e5+5;vector&
2020-05-18 13:41:25 2343
原创 Educational Codeforces Round 87 (Rated for Div. 2) C1.Simple Polygon Embedding
Educational Codeforces Round 87 (Rated for Div. 2) C1.Simple Polygon Embedding题目链接The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, n is always even, and in C2, n is always odd.You are
2020-05-18 13:28:39 2548
原创 Codeforces Round #643 (Div. 2) D.Game With Array
Codeforces Round #643 (Div. 2) D.Game With Array题目链接Petya and Vasya are competing with each other in a new interesting game as they always do.At the beginning of the game Petya has to come up with an array of N positive integers. Sum of all elements in
2020-05-17 11:46:07 2409
原创 Codeforces Round #643 (Div. 2) C.Count Triangles
Codeforces Round #643 (Div. 2) C.Count Triangles题目链接Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A≤B≤C≤D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z
2020-05-17 10:19:06 2722
原创 Codeforces Round #643 (Div. 2) B.Young Explorers
Codeforces Round #643 (Div. 2) B.Young Explorers题目链接Young wilderness explorers set off to their first expedition led by senior explorer Russell. Explorers went into a forest, set up a camp and decided to split into groups to explore as much interesting l
2020-05-17 09:54:48 2451
原创 Codeforces Round #642 (Div. 3) D.Constructing the Array
Codeforces Round #642 (Div. 3) D.Constructing the Array题目链接You are given an array a of length n consisting of zeros. You perform n actions with this array: during the i-th action, the following sequence of operations appears:Choose the maximum by length
2020-05-15 19:33:08 2364
原创 Codeforces Round #641 (Div. 2) C.Orac and LCM
Codeforces Round #641 (Div. 2) C.Orac and LCM题目链接For the multiset of positive integers s={s1,s2,…,sk}, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of s as follow:gcd(s) is the maximum positive integer x, such that all integ
2020-05-15 09:33:46 2411
原创 Codeforces Round #641 (Div. 2) B.Orac and Models
Codeforces Round #641 (Div. 2) B.Orac and Models题目链接There are n models in the shop numbered from 1 to n, with sizes s1,s2,…,sn.Orac will buy some of the models and will arrange them in the order of increasing numbers (i.e. indices, but not sizes).Orac
2020-05-13 18:03:52 2323
原创 Codeforces Round #640 (Div. 4) G.Special Permutation
Codeforces Round #640 (Div. 4) G.Special Permutation题目链接A permutation of length n is an array p=[p1,p2,…,pn], which contains every integer from 1 to n (inclusive) and, moreover, each number appears exactly once. For example, p=[3,1,4,2,5] is a permutatio
2020-05-13 15:21:40 2336
原创 Codeforces Round #640 (Div. 4) F.Binary String Reconstruction
Codeforces Round #640 (Div. 4) F.Binary String Reconstruction题目链接For some binary string s (i.e. each character si is either ‘0’ or ‘1’), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written.
2020-05-13 14:59:09 2307
原创 Codeforces Round #640 (Div. 4) E.Special Elements
Codeforces Round #640 (Div. 4) E.Special Elements题目链接Pay attention to the non-standard memory limit in this problem.In order to cut off efficient solutions from inefficient ones in this problem, the time limit is rather strict. Prefer to use compiled st
2020-05-13 14:33:10 18986 1
原创 Codeforces Round #640 (Div. 4) D. Alice, Bob and Candies
Codeforces Round #640 (Div. 4) D. Alice, Bob and Candies题目链接There are n candies in a row, they are numbered from left to right from 1 to n. The size of the i-th candy is ai.Alice and Bob play an interesting and tasty game: they eat candy. Alice will eat
2020-05-13 11:11:47 2494
原创 Codeforces Round #640 (Div. 4) C. K-th Not Divisible by n
Codeforces Round #640 (Div. 4) C. K-th Not Divisible by n题目链接You are given two positive integers n and k. Print the k-th positive integer that is not divisible by n.For example, if n=3, and k=7, then all numbers that are not divisible by 3 are: 1,2,4,5,
2020-05-13 10:13:30 2277
原创 Codeforces Round #640 (Div. 4) B. Same Parity Summands
Codeforces Round #640 (Div. 4) B. Same Parity Summands题目链接You are given two positive integers n (1≤n≤109) and k (1≤k≤100). Represent the number n as the sum of k positive integers of the same parity (have the same remainder when divided by 2).In other w
2020-05-13 09:58:47 2362
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人