---恢复内容开始--- Description Given a 3-dimension ellipsoid(椭球面) your task is to find the minimal distance between the original point (0,0,0) and points on the ellipsoid. The distance between two points (x 1,y 1,z 1) and (x 2,y 2,z 2) is defined as    Inp…
Problem Description Noting is more interesting than rotation! Your little sister likes to rotate things. To put it easier to analyze, your sister makes n rotations. In the i-th time, she makes everything in the plane rotate counter-clockwisely around…
n堆石子,每次可以选一堆取走至少一个,之后你可以不操作或者把该堆石子分成两堆,每堆至少一个,和还是原来(取完石子后)的石子个数. Sample Input1121 131 2 3 Sample OutputWinLoseLose # include <iostream> # include <cstdio> # include <cstring> # include <string> # include <algorithm> # include…
题意:出现Apple.iPod.iPhone.iPad时输出MAI MAI MAI!,出现Sony,输出SONY DAFA IS GOOD! Sample InputApple bananaiPad lemon ApplepiSony233Tim cook is doubi from AppleiPhoneipadiPhone30 is so biiiiiiig Microsoftmakes good App. Sample OutputMAI MAI MAI!MAI MAI MAI!MAI M…
Description There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● a i ∈ [0,n] ● a i ≠ a j( i ≠ j ) For sequence a and sequence b, the integrating degree t is defined as follows(“�” denotes exclus…
Description Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since every operator in an expression follows all of its operands. Bob is a student in…
地址 题意:求在m种颜色中挑选k种颜色,给n个花朵涂色有几种方法. 分析:画图可以发现,基本的公式就是k ×(k-1)^(n-1).但这仅保证了相邻颜色不同,总颜色数不超过k种,并没有保证恰好出现k种颜色:接着就是一个容斥问题,上述计算方法中包含了只含有2.3.….(k-1)种颜色的情况,需要通过容斥原理去除.假设出现p (2 <= p <= k-1)种颜色,从k种颜色中选取p种进行涂色,方案数为C(k,p) × p × (p-1)^(n-1) :总的方案数就是C(m,k) × ( k × (…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5014 题意:给出范围N,给出0-N的一个排列a.让你求出另外一个排列b,使 t = a1 ^ b1 + a2 ^ b2 + ...+an ^ bn(^表示异或)最大.并求出最大的t. 思路:首先,我们要注意到的是,一定存在解,且解不唯一.同时,因为是异或操作,要想得到最大值,我们必须让ai,bi对应的二进制表示,0和1错开,这样才不会使值减少. 这样,我们要构造出错开的0和1的二进制表达即可. #inc…
n个格子排成一行,有m种颜色,问用恰好k种颜色进行染色,使得相邻格子颜色不同的方案数. integers n, m, k (1 ≤n, m ≤ 10^9, 1 ≤ k ≤ 10^6, k ≤ n, m). m种颜色取k种 C(m, k) 这个可以放最后乘 那么问题就变成只用k种颜色第一个格子有k种涂法 第二个有k-1种 第三个也是k-1种 一共就是k*(k-1)^(n-1) 这种算法仅保证了相邻颜色不同,总颜色数不超过k种,并没有保证恰好出现k种颜色 也就是多算了恰好出现2种 恰好出现3种...…
题目大意:给你L到N的范围,要求你求这个范围内的所有整数的立方和. Sample Input2 //T1 32 5 Sample OutputCase #1: 36Case #2: 224 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmath> # define LL long long using na…