05 2018 档案
摘要:题意:01给出一个数n,现在要将它分为m个数,这m个数相加起来必须等于n,并且要使得这m个数的或值最小。 思路分析: 一个简单的贪心,从高位到低位,判断当前位可否为 1 ,若可以,则将所有的数的这一位全部都变成 1 代码示例:
阅读全文
摘要:A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It i
阅读全文
摘要:推荐博客:https://www.cnblogs.com/zinthos/p/3899725.html 所谓的后缀数组,就是将字符串的 n 个后缀全部取出来,采用字典序的排序方式,将排序好的后缀开头位置顺次放进数组中。 在后缀数组中,有几个关键的变量 1 . SA 数组,若 sa[ i ] = j
阅读全文
摘要:For an array b of length m we define the function f as where ⊕ is bitwise exclusive OR. For example, f(1,2,4,8)=f(1⊕2,2⊕4,4⊕8)=f(3,6,12)=f(3⊕6,6⊕12)=f
阅读全文
摘要:You are given several queries. Each query consists of three integers p, q and b. You need to answer whether the result of p/q in notation with base b
阅读全文
摘要:Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/112/D来源:牛客网 题目描述 一个只含数字的字符串,q次操作,每次操作将第i位数字改为x,每次操作后,统计长度在[l, r]之间且首数字大于尾数字的子串的个数。 输入描述: 第一行一个只含数字的字符串;第二行3个整数
阅读全文
摘要:Nim is a two-player mathematic game of strategy in which players take turns removing objects from distinct heaps. On each turn, a player must remove a
阅读全文
摘要:推荐博客 :http://www.cnitblog.com/weiweibbs/articles/42735.html 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3)
阅读全文
摘要:Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser of the two
阅读全文
摘要:Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ..., and place
阅读全文
摘要:问题描述 : 有N堆物品,其中第 i 堆有 pi 个物品,每次从一堆中选出若干个物品去掉(但不能为 0 ),两人轮流取物品,谁不能取谁就输了,问什么情况下会先手必胜? 代码示例 : 尼姆博弈有几种经典的扩展形式 1 . 限定每次取物的上限 问题 : 有 n 堆物品,其中第 i 堆有 pi 个物品,每
阅读全文
摘要:题目类型 : 有两堆物品数量若干,两人轮流从某一堆或同时从两堆中选取同样多的物品,规定每次最小选一个,多者不限,最后一次取尽者获胜。 分析 : 相比于巴什博弈,此种博弈得情形更加复杂些,我们用(X , Y)表示当前得局势,如果甲面对(0 , 0)说明甲输掉了比赛,我们称这种状态是奇异局势,前几个奇异
阅读全文
摘要:There has been considerable archeological work on the ancient Myacm culture. Many artifacts have been found in what have been called power fields: a f
阅读全文
摘要:Given are the (x,y) coordinates of the endpoints of two adjacent sides of a parallelogram. Find the (x,y) coordinates of the fourth point. Input Each
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/109/C来源:牛客网 题目描述 给定长度为n的数组a,定义一次操作为: 1. 算出长度为n的数组s,使得si= (a[1] + a[2] + ... + a[i]) mod 1,000,000,007; 2. 执行a
阅读全文
摘要:import java.math.*; import java.util.*; public class study { public static void main(String[] args) { // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); BigInteger a, b...
阅读全文
摘要:Statement of the Problem Several drawing applications allow us to draw polygons and almost all of them allow us to fill them with some color. The task
阅读全文
摘要:题目大意:依次给定多个点(要求第一个点和最后一个点重叠),把前后两个点相连求最后得到的图形的面的个数 思路分析 : 借助欧拉定理,V+F-E = 2,只要求出点的数量和边的数量就可以计算出面的数量,点的数量只要枚举直线就可以,但是有可能有重复的点,之最去重一下就可以,然后在枚举剩下的点出现在几条直线
阅读全文
摘要:unique 函数是用来去除一个集合中重复元素的函数 若是在数组中,则调用此函数后,返回的除去重复元素的下一个指针的地方 若是在 vector中,则会返回重复元素下一个位置的迭代器,在调用erase函数,真正的删除
阅读全文
摘要:推荐博客 :https://blog.csdn.net/jjj19891128/article/details/22685605 https://blog.csdn.net/jq_develop/article/details/44981127 结构体的定义 点 直线 多边形 圆 整体一起 jls
阅读全文
摘要:struct point { double x, y; point(double _x, double _y):x(_x), y(_y){} // 点-点=向量 point operator-(const point &v){ return point(x-v.x, y-v.y); } int dcmp(doub...
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/105/H来源:牛客网 题目描述 n个桶按顺序排列,我们用1~n给桶标号。有两种操作: 1 l r c 区间[l,r]中的每个桶中都放入一个颜色为c的球 (1≤l,r ≤n,l≤r,0≤c≤60) 2 l r 查询区间[
阅读全文