
数学题
文章平均质量分 80
RJ28
小学生
展开
-
2017 ACM-ICPC 亚洲区(西安赛区)网络赛 E. Maximum Flow
Given a directed graph with nnn nodes, labeled 0,1,⋯,n−10,1, \cdots, n-10,1,⋯,n−1.For each i,j> satisfies 0≤i0≤ijn, there exists an edge from the i-th node to the j-th node, the capacity of wh原创 2017-09-16 21:56:39 · 342 阅读 · 0 评论 -
Codeforces Round #382 (Div. 1) A. Tennis Championship(递推)
Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules fro原创 2016-12-06 08:38:50 · 334 阅读 · 0 评论 -
Hdu-4609 3-idiots(NTT)
题意:给n个木棍,随机选三个,问能组成三角形的概率是多少。分析:我们枚举最长边,分三种情况:1.最长边出现三次,事件个数为A(k,3). 2.最长边出现两次,事件个数为3*A(k,2)*小于最长边的边数. 3.最长边出现一次,此时需要求出原边长值域(其实是每个值出现的次数)数列的卷积,得到的新数列的一项 ci 为边长和等于 i 的 边对数,然后我们就可以通过ci的前缀和来得到第原创 2016-12-10 22:05:24 · 421 阅读 · 0 评论 -
Codeforces Round #380 Div. 1 B. Sea Battle(贪心)
Galya is playing one-dimensional(肤浅的) Sea Battle on a1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of b consecutive(连贯的) cells. No cell can be part of two s原创 2016-11-30 10:02:52 · 292 阅读 · 0 评论 -
Hdu-5894 hannnnah_j’s Biological Test(组合数学)
Descriptionhannnnah_j is a teacher in WL High school who teaches biology.One day, she wants to test m students, thus she arranges n different seats around a round table.In order to pre原创 2016-10-16 20:10:52 · 384 阅读 · 0 评论 -
Codeforces Beta Round #10 E. Greedy Change(贪心)
Billy investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amo原创 2016-10-23 16:33:57 · 836 阅读 · 0 评论 -
Codeforces Round #362 (Div. 1) B. Puzzles(递推)
B. Puzzlestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBarney lives in country USC (United States of Charzeh). USC原创 2016-09-23 14:33:47 · 304 阅读 · 0 评论 -
Hdu-5833 Zhu and 772002(高斯消元)
Problem DescriptionZhu and 772002 are both good at math. One day, Zhu wants to test the ability of 772002, so he asks 772002 to solve a math problem.But 772002 has a appointment with his girl原创 2016-08-14 21:43:51 · 451 阅读 · 0 评论 -
Codeforces Round #372 (Div. 1) C. Digit Tree(树的点分治)
ZS the Coder has a large tree. It can be represented as an undirected connected graph ofn vertices numbered from 0 to n - 1 and n - 1 edges between them. There is a single nonzero digit writte原创 2016-09-18 01:21:21 · 769 阅读 · 0 评论 -
Codeforces Round #370 (Div. 2) C. Memory and De-Evolution
Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side lengthx, and he wishes to perform operations to obtain an equilateral原创 2016-09-11 23:20:08 · 217 阅读 · 0 评论 -
LA-4727 Jump(递推)
题意:给定n和k,问每隔k人的n人约瑟夫游戏中最后出局的三个人的编号。分析:设f(i,j)表示共i个人的约瑟夫环中出局的第j个人的编号,我们每出局一个人重新编号后有f(i,j) = (f(i-1,j-1) + k) % i.#include#include#include#include#include#include#include#include原创 2017-02-01 22:12:06 · 285 阅读 · 0 评论 -
Codeforces Round #404 (Div. 2) D. Anton and School - 2(范德蒙恒等式)
As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round b原创 2017-03-18 13:20:48 · 656 阅读 · 0 评论 -
CodeForces - 842C Ilya And The Tree(树上倍增)
Ilya is very fond of graphs, especially trees. During his last trip to the forest Ilya found a very interesting tree rooted at vertex1. There is an integer number written on each vertex of the tree;原创 2017-09-15 16:14:14 · 339 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 Colored Graph(贪心构造)
In graph theory, graph colouring is a special case of graph labelling.It is an assignment of labels traditionally called colours to edges of a graph.Here we consider the simplest form.Given an u原创 2017-09-14 00:02:30 · 323 阅读 · 0 评论 -
Poj-3696 The Luckiest number(数论)
Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to construct his luckiest number which is the minimum among all positiv原创 2017-08-08 23:22:34 · 271 阅读 · 0 评论 -
Hdu-6053 TrickGCD(莫比乌斯函数)
You are given an array A, and Zhu wants to know there are how many different array B satisfy the following conditions? * 1≤Bi≤Ai 1 ≤Bi≤Ai * For each pair( l , r ) (1≤l≤r≤n ) , gcd(bl原创 2017-07-27 21:09:34 · 741 阅读 · 2 评论 -
Xiangtan Invitation Contest 2017 - C Similar Subsequence(高斯消元)
IntersectionBobo has two sets of integers A={a1,a2,…,an} and B={b1,b2,…,bn}. He says that x∈span(A) (or span(B)) if and only if there exists a subset of A (or B) whose exclusive-or sum equals原创 2017-05-19 16:16:05 · 549 阅读 · 2 评论 -
Codeforces Round #410 (Div. 2) D. Mike and distribution(贪心)
Mike has always been thinking about the harshness of social inequality. He's so obsessed with it that sometimes it even affects him while solving problems. At the moment, Mike has two sequences of pos原创 2017-04-24 15:34:59 · 525 阅读 · 0 评论 -
Uva-11768 Lattice Point or Not(欧扩)
题意:给你一个线段,问线段上有多少个整点.分析:我们先把直线的一般式搞出来,ax+by=c的形式,然后用欧扩求出直线一个整数点,设其横标为x,那么答案就是floor((x2-x)/b') - ceil((x1-x)/b') + 1. (x2 >= x1, b' = b/gcd(a,b)).#include #define INF 1047483647#define ep原创 2017-04-19 22:18:02 · 602 阅读 · 0 评论 -
Codeforces Round #276 (Div. 1) B. Maximum Value(数论)
You are given a sequence a consisting of n integers. Find the maximum possible value of (integer remainder of ai divided by aj), where 1 ≤ i, j ≤ n and ai ≥ aj.InputThe first line原创 2017-04-30 21:16:15 · 335 阅读 · 0 评论 -
ICPCCamp Day1 C. City United(脑洞状压dp)
题目大意:给n(n 分析:原创 2017-03-10 21:07:51 · 467 阅读 · 0 评论 -
Hdu-4507 吉哥系列故事——恨7不成妻(数位DP)
Description 单身! 依然单身! 吉哥依然单身! DS级码农吉哥依然单身! 所以,他生平最恨情人节,不管是214还是77,他都讨厌! 吉哥观察了214和77这两个数,发现: 2+1+4=7 7+7=7*2 77=7*11 最终,他发现原来这一切归根到底都是因为和7有关!所以,他现在甚至讨厌一切和7原创 2016-08-19 21:32:56 · 379 阅读 · 0 评论 -
Codeforces Round #364 (Div. 1) A. As Fast As Possible
On vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the lengthl meters. Each of the pupils will go with the speed equal tov1. To get to th原创 2016-09-09 22:35:24 · 342 阅读 · 0 评论 -
CodeForces 629C Famil Door and Brackets
As Famil Door’s birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Famil Door loves string of原创 2016-05-15 18:05:46 · 428 阅读 · 0 评论 -
Codeforces Round #246 (Div. 2) C. Prime Swaps
You have an array a[1], a[2], ..., a[n], containing distinct integers from1 to n. Your task is to sort this array in increasing order with the following operation (you may need to apply it multiple原创 2016-05-14 19:54:37 · 365 阅读 · 0 评论 -
POJ-3292 Semi-prime H-numbers
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8564 Accepted: 3739DescriptionThis problem is based on an exercise of David Hilbert, who pedagogically suggested t原创 2016-04-19 22:01:30 · 336 阅读 · 0 评论 -
LA 4094 Wonder Team
The Brasileiro League is the most important event in Brazil. There aren football teams participating in the competitions, each team plays twice (home and away) against each other team. Each team rec原创 2016-05-03 15:28:02 · 923 阅读 · 0 评论 -
POJ-2635 The Embarrassed Cryptographer
DescriptionThe young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptographic原创 2016-04-18 22:06:12 · 351 阅读 · 0 评论 -
Codeforces 658D Bear and Polynomials
Limak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.He considers a polynomial valid if its degree is n and its coefficients are integers not exceedin原创 2016-04-16 22:00:37 · 577 阅读 · 0 评论 -
Codeforces Round #332 (Div. 2) D. Spongebob and Squares
Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactlyx distinct squares in the table consis原创 2016-05-11 10:01:24 · 824 阅读 · 0 评论 -
Codeforces Round #191 (Div. 2) C. Magic Five
There is a long plate s containing n digits. Iahub wants to delete some digits (possibly none, but he is not allowed to delete all the digits) to form his "magic number" on the plate, a number that原创 2016-05-10 17:18:54 · 464 阅读 · 0 评论 -
POJ-2115 C Looooops
DescriptionA Compiler Mystery: We are given a C-language style for loop of typefor (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to原创 2016-04-27 23:03:19 · 419 阅读 · 0 评论 -
Hdu-5344 MZL's xor
Problem DescriptionMZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤i,j≤n)The xor of an array B is defined as B1 xor B2...xorBn原创 2016-05-29 17:54:47 · 380 阅读 · 0 评论 -
Codeforces Round #258 (Div. 2) D. Count Good Substrings
We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".原创 2016-05-08 21:46:12 · 326 阅读 · 0 评论 -
Hdu-5792 World is Exploding(简单容斥)
Problem DescriptionGiven a sequence A with length n,count how many quadruple (a,b,c,d) satisfies:a≠b≠c≠d,1≤ab≤n,1≤cd≤n,AaAb,Ac>Ad. InputThe input consists of multiple test cases. Each te原创 2016-08-03 10:55:04 · 270 阅读 · 0 评论 -
LA 7457 Discrete Logarithm Problem(shank的大步小布算法)
题意:求a^x % p = b的最小x。#include#include#include#include#include#include#include#include#include #include#include#include#include#define INF 0x3f3f3f3f#define eps 1e-9#define MAXN 10原创 2016-08-17 21:17:00 · 772 阅读 · 0 评论 -
Gym 100818B Tree of Almost Clean Money
题意:给你一棵树,每次一个操作,修改书上最多不超过1000个点的值,然后询问u到v路径上的权值和。分析:树链剖分,后边单点修改区间查询可以用树状数组。#include#include#include#include#include#include#include#include#define INF 0x3f3f3f3f#define MOD 100000原创 2016-08-27 20:30:41 · 577 阅读 · 0 评论 -
Hdu-5734 Acperience
Problem DescriptionDeep neural networks (DNN) have shown significant improvements in several application domains including computer vision and speech recognition. In computer vision, a particular ty原创 2016-07-22 10:59:45 · 402 阅读 · 0 评论 -
Hdu-5739 Fantasia (图论点双连通分量+DP)
Problem DescriptionProfessor Zhang has an undirected graph G with n vertices and m edges. Each vertex is attached with a weight wi. Let Gi be the graph after deleting the i-th vertex f原创 2016-07-23 22:58:36 · 636 阅读 · 0 评论 -
Educational Codeforces Round 11 D. Number of Parallelograms
You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points.InputThe first原创 2016-05-21 22:16:46 · 543 阅读 · 0 评论