Master-Mind Hints
MasterMind is a game for two players. One of them, Designer, selects a secret code. The other,Breaker, tries to break it. A code is no more than a row of colored dots. ...
分类:
其他好文 时间:
2014-07-30 14:44:53
阅读次数:
242
题目:一个数的素因子的和如果也是素数就叫做DePrimes,统计给定区间内的DePrimes。
分析:数论。本题使用用一种素数的筛法,欧拉筛法,也加线性筛法。
这种方法,每次删选分两种情况:1.素因子不重复、2.素因子重复;
利用这个性质,统计DePrimes,如果素因子不同就加和,否则就去相应的...
分类:
其他好文 时间:
2014-07-30 12:20:03
阅读次数:
398
动态规划题意可以理解为两个人同时从最左点出发,沿着两条不同的路径走到最右点(除了起点和终点每个点走且仅走一次)状态 dp[i][j]指当前两人分别走到i,j点。且设i>j;则有:dp[i+1][i]=min (dp[i+1][i],dp[i][j]+dist[i][i+1]); dp[i+1]...
分类:
其他好文 时间:
2014-07-30 11:28:54
阅读次数:
216
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define bug cout\n"
#define MAXN 10001;
char same[]={"AHIMO0TUVWXY18"};
bool mirror(st...
分类:
其他好文 时间:
2014-07-30 10:03:43
阅读次数:
236
UVA 11992 - Fast Matrix Operations
题目链接
题意:给定一个矩阵,3种操作,在一个矩阵中添加值a,设置值a,查询和
思路:由于最多20列,所以完全可以当作20个线段树来做,然后线段树是区间修改区间查询,利用延迟操作,开两个延迟值一个存放set操作,一个存放add操作
代码:
#include
#include
#include
...
分类:
其他好文 时间:
2014-07-30 05:36:03
阅读次数:
320
给定一个矩阵,3种操作,在一个矩阵中添加值a,设置值a,查询和思路:由于最多20列,所以完全可以当作20个线段树来做,然后线段树是区间修改区间查询,利用延迟操作,开两个延迟值一个存放set操作,一个存放add操作代码:[cpp] view plaincopy#include#include#incl...
分类:
其他好文 时间:
2014-07-30 05:34:23
阅读次数:
334
Palindromes
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when t...
分类:
其他好文 时间:
2014-07-29 21:57:12
阅读次数:
308
For a positive integer N , the digit-sum of N is defined as the sum of N itself and its digits.
When M is the digitsum of N , we call N a generator of M .
For example, the digit-sum of 245 is 256 (...
分类:
其他好文 时间:
2014-07-29 21:53:12
阅读次数:
284
这是一道简单的并查集的题目,跟UVA 10608 Friends 差不多。
对于统计桌子的数目,我用了两种方法:
1、先将桌子数目初始化为n,然后合并一次就减一张。
2、先将朋友们分好组,在统计 fa[i]=i 的这些根节点有多少即为所求的桌子数。...
分类:
其他好文 时间:
2014-07-29 18:10:42
阅读次数:
213
题目:
Product
The Problem
The problem is to multiply two integers X, Y. (0250)
The Input
The input will consist of a set of pairs of lines. Each line in pair contains one mu...
分类:
其他好文 时间:
2014-07-29 18:03:42
阅读次数:
283