随笔分类 - ACM-数论
摘要: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 luck
阅读全文
摘要:1303: [CQOI2009]中位数图 Description 给出1~n的一个排列,统计该排列有多少个长度为奇数的连续子序列的中位数是b。中位数是指把所有元素从小到大排列后,位于中间的数。 Input 第一行为两个正整数n和b ,第二行为1~n 的排列。 Output 输出一个整数,即中位数为b
阅读全文
摘要:1192: [HNOI2006]鬼谷子的钱袋 Description 鬼谷子非常聪明,正因为这样,他非常繁忙,经常有各诸侯车的特派员前来向他咨询时政。有一天,他在咸阳游历的时候,朋友告诉他在咸阳最大的拍卖行(聚宝商行)将要举行一场拍卖会,其中有一件宝物引起了他极大的兴趣,那就是无字天书。但是,他的行
阅读全文
摘要:3085: 反质数加强版SAPGAP Description 先解释一下SAPGAP=Super AntiPrime, Greatest AntiPrime(真不是网络流),于是你就应该知道本题是一个关于反质数(Antiprime)的问题。下面给出反质数的定义: 将一个正整数i的约数个数记为g(i)
阅读全文
摘要:1053: [HAOI2007]反素数ant Description 对于任何正整数x,其约数的个数记作g(x)。例如g(1)=1、g(6)=4。如果某个正整数x满足:g(x)>g(i) 0<i<x ,则称x为反质数。例如,整数1,2,4,6等都是反质数。现在给定一个数N,你能求出不超过N的最大的反
阅读全文
摘要:Given an array of integers , we say a set is a prime set of the given array, if and is prime. BaoBao has just found an array of integers in his pocket
阅读全文
摘要:DreamGrid has a nonnegative integer . He would like to divide into nonnegative integers and minimizes their bitwise or (i.e. and should be as small as
阅读全文
摘要:Little boxes on the hillside. Little boxes made of ticky-tacky. Little boxes. Little boxes. Little boxes all the same. There are a green boxes, and b
阅读全文
摘要:A triangle is a Heron’s triangle if it satisfies that the side lengths of it are consecutive integers t−1, t, t+ 1 and thatits area is an intege
阅读全文
摘要:Jessie and Justin want to participate in e-sports. E-sports contain many games, but they don't know which one to choose, so they use a way to make dec
阅读全文
摘要:There are NN children in kindergarten. Miss Li bought them NN candies. To make the process more interesting, Miss Li comes up with the rule: All the c
阅读全文
摘要:Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integ
阅读全文
摘要:Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets on that day, no matter how
阅读全文
摘要:You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold. Initially you are i
阅读全文
摘要:You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all
阅读全文
摘要:一:N条直线分割平面 假设,x条线能将平面分为f(x)份,这对于份f(n) 第n条线,和其他n-1条线都有交点时,增加量最大,为n; 则: f(n)=f(n-1)+n; 有f(0)=1;得到:n 条直线分割平面的数量最大为:f(n)=n*(n+1)/2 + 1; 二. “V” 形线分割平面 对于“V
阅读全文
摘要:Little Q and Little T are playing a game on a tree. There are n vertices on the tree, labeled by 1,2,...,n , connected by n−1 bidirectional edges. The
阅读全文
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=6322 Problem Description In number theory, Euler's totient function φ(n) counts the positive integers up
阅读全文
摘要:Given an integer nn, Chiaki would like to find three positive integers xx, yy and zzsuch that: n=x+y+zn=x+y+z, x∣nx∣n, y∣ny∣n, z∣nz∣n ...
阅读全文
摘要:LsF is visiting a local amusement park with his friends, and a mirror room successfully attracts his attention. Inside the mirror room...
阅读全文