#includeusing namespace std;/*计算括号化方案数:标量乘法作为代价衡量,应该使标量乘法尽可能少。m[i,j]表示Ai.....Aj所需标量乘法的最小值。i=j 时只有一个矩阵,无需分割 m[i,i]=0;采用自底向上的方式:*/int m[100][100];int p....
分类:
编程语言 时间:
2015-08-08 11:56:39
阅读次数:
116
题目链接:点击打开链接
题目大意:有n个人围城一个环,每一个人手里都有一些糖果,第i个人有ai块。
现在有三种操作:
第i个人给第i+1个人一块。如果i有
第i+1个人给第i个人一块。如果i+1有
什么都不做。
第i个人和第i+1个人之间,可以选择一种操作并执行,问最终能不能让所有人手里的糖相等。
当n = 1 时,永远是YES
当n = 2 时,注意1和2之间只能有一种操作,不存...
分类:
其他好文 时间:
2015-08-07 20:15:37
阅读次数:
104
对与U3D AI,看了下,自己做了小功能,以备后用啊!
一,在某区域随机产生某个对象
C# 文件名称为RadomAPoint.cs
using UnityEngine;
using System.Collections;
public class RadomAPoint : MonoBehaviour {
public GameObject mObjArea; // 随...
分类:
编程语言 时间:
2015-08-07 13:21:39
阅读次数:
487
题意 给你一个数n 求满足lcm(a, b) == n, a
容易知道 n 是a, b的所有素因子取在a, b中较大指数的积
先将n分解为素数指数积的形式 n = π(pi^ei) 那么对于每个素因子pi pi在a,b中的指数ai, bi 至少有一个等于pi, 另一个小于等于pi
先不考虑a, b的大小 对于每个素因子pi
1. 在a中的指数 ai == ei 那么 ...
分类:
其他好文 时间:
2015-08-07 09:36:35
阅读次数:
151
题目:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints ...
分类:
其他好文 时间:
2015-08-06 11:06:23
阅读次数:
81
here:
首先看一下题吧:题意就是让你把一个序列里所有的(Ai+Aj) 的异或求出来。(1
Problem Description
MZL 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)
...
分类:
其他好文 时间:
2015-08-06 09:31:18
阅读次数:
215
题意:n个数的两两做和,然后异或
分析:
异或的性质:两个相同的数异或为0,所以Ai+Aj异或Aj+Ai等于0,所以最终结果就是Ai+Ai的异或
代码:
#include
long long t,n,m,z,l;
long long a[1000005];
int main()
{
scanf("%I64d",&t);
while(t--){
scanf("...
分类:
其他好文 时间:
2015-08-06 02:06:15
阅读次数:
124
https://leetcode.com/problems/container-with-most-water/题目:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai...
分类:
其他好文 时间:
2015-08-06 01:54:09
阅读次数:
140
MZL 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 a...
分类:
其他好文 时间:
2015-08-06 00:00:57
阅读次数:
510
题意:N个参加聚会,和一个数组a,ai表示第i个人讨厌的人,如果一个到聚会门口的时候发现他讨厌的人已经在聚会里面,则他不会参加聚会,否则他会参加聚会。ai==i表示他没有讨厌的人。N个人来的先后顺序是任意的,也就是说n个来的先后顺序构成的1到n的排列是任意的。问参加聚会的人的期望是多少?...
分类:
其他好文 时间:
2015-08-05 20:27:00
阅读次数:
382