02 2017 档案
摘要:Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful g
阅读全文
摘要:Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in
阅读全文
摘要:Description 今天的数学课上,Crash小朋友学习了最小公倍数(Least Common Multiple)。对于两个正整数a和b,LCM(a, b)表示能同时被a和b整除的最小正整数。例如,LCM(6, 8) = 24。回到家后,Crash还在想着课上学的东西,为了研究最小公倍数,他画了
阅读全文
摘要:Each New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th
阅读全文
摘要:Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity — origami, but remembered the puzzle that s
阅读全文
摘要:Description 有一张N×m的数表,其第i行第j列(1 < =i < =礼,1 < =j < =m)的数值为 能同时整除i和j的所有自然数之和。给定a,计算数表中不大于a的数之和。 有一张N×m的数表,其第i行第j列(1 < =i < =礼,1 < =j < =m)的数值为 能同时整除i和j
阅读全文
摘要:因为我没有BZOJ的权限号,所以我的代码只是过了样例,所以具体的细节我也不知道过没有,所以看我博客的同学要是不麻烦的话可以交一下我的代码。。 Description 神犇YY虐完数论后给傻×kAc出了一题 给定N, M,求1<=x<=N, 1<=y<=M且gcd(x, y)为质数的(x, y)有多少
阅读全文
摘要:题意 输入a,找到满足n!>a^n 最小的n。 数据 第一行T(1 <= T <= 1e5),表示测试样例数.(2 <= a <= 1e6)。 输入 3 2 3 4 输出 4 7 9 这个东西一看就知道是二分求解的,但是我们还是不知道怎么求的,我们可以吧他们取对数然后我们很惊奇的发现原来真的是取对数
阅读全文
摘要:题意 给出一个字符串,包含'(',')','?'三种字符,将一个'?'变为左括号需要花费ai,将一个'?'变成右括号需要花费bi 求将字符串变为合法括号序列的最小代价和此时的合法括号序列,无解输出'-1' 数据 字符串长度为偶数,长度 <= 5*10^4, 1 <= ai,bi <= 10^6 输入
阅读全文
摘要:VLATTICE - Visible Lattice Points Consider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are v
阅读全文
摘要:给出一个正奇数K,两个正整数low,high。 有多少整数属于[low, high],且包含K个因子。 数据 C(0 < C < 1e5),测试样例数。 (1 < K < 10000, 0 < low <= high < 1e10)。 输入 3 3 2 49 9 1 100 5 55 235 输出
阅读全文
摘要:void Init() { memset(vis,0,sizeof(vis)); mu[1] = 1; cnt = 0; for(int i=2; i<N; i++) { if(!vis[i]) { prime[cnt++] = i; mu[i] = -1; }...
阅读全文
摘要:Description 小 X 自幼就很喜欢数。但奇怪的是,他十分讨厌完全平方数。他觉得这些 数看起来很令人难受。由此,他也讨厌所有是完全平方数的正整数倍的数。然而 这丝毫不影响他对其他数的热爱。 这天是小X的生日,小 W 想送一个数给他作为生日礼物。当然他不能送一 个小X讨厌的数。他列出了所有小X
阅读全文
摘要:Student Arseny likes to plan his life for n days ahead. He visits a canteen every day and he has already decided what he will order in each of the fol
阅读全文
摘要:Problem Description There are m stones lying on a circle, and n frogs are jumping over them.The stones are numbered from 0 to m−1 and the frogs are nu
阅读全文
摘要:这就是这个题目的意思,真的感觉这个思想是太神奇了,我这种菜逼现在绝壁想不到这样的证明的过程的,还有就是这个题的推道过程,以下思路纯属借鉴卿学姐的,还是自己太菜了,,,, 讲道理这种问题我真的想不到用容斥原理来做啊,那现在我就用容斥原理来讲一下这个问题,,, |!A1∩!A2∩!A3∩....!An|
阅读全文
摘要:B. Pasha and Phone time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has recently bou
阅读全文
摘要:Problem Description Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common div
阅读全文
摘要:LL mult(LL a, LL k, LL m){ LL res = 0; while(k){ if(k & 1LL) res = (res + a) % m; k >>= 1; a = (a << 1) % m; } return res; }
阅读全文
摘要:Problem Description When ?? was born, seven crows flew in and stopped beside him. In its childhood, ?? had been unfortunately fall into the sea. While
阅读全文
摘要:E. Devu and Flowers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Devu wants to decora
阅读全文