- 博客(15)
- 资源 (3)
- 收藏
- 关注
原创 关于按位异或用于抵消成对出现的数据
给n个数其中n-1个数出现了两次只有一个数出现了一次,找到它并输出一组测试,输入n个数,均可用int表示n由于0^0为0,0^1为1,所以0按位异或任何数都是这个数字本身;对于两个相同的数字,由于每一位都相同,所以这两个数的按位异或为0,于是就抵消了;当数字不是按照两个相同数字连在一起给出时,会有以下几种情况:ans = 0^n1
2013-11-10 16:34:29
780
原创 关于qsort的比较函数的不同写法对于大数据造成的错误
关于qsort的比较函数的不同写法对于大数据造成的错误先看一下这两份代码:代码1:AC#include#include#include#includeusing namespace std;#define N 5050int p[N];double point[2][110];struct road{ int a, b; double dis;}node[N
2013-07-16 01:46:11
814
原创 计算几何:关于求多边形的重心
计算几何:关于求多边形的重心 将一个多边形分解为以编号0的点为原点的若干个三角形求出每个三角形的面积a, //即两向量的叉乘的模,a = ( x1 * y2 - x2 * y1 ) / 2;以及每个三角形的重心的坐标(x,y); //即三个点的坐标的平均数,x = (x1+x2+x3)/3; y = (y1+y2+y3)/3;smux = Sigma( xi * ai );
2013-03-03 15:28:09
490
转载 关于添加cmd到鼠标右键菜单
文件夹选项 -> 文件类型 -> 资料夹 -> 高级 -> 新建 -> 操作 -> Run cmd用于执行命令的应用程序 -> c:\windows\system32\cmd.exe对应的注册表修改方法:【HKEY_CLASSES_ROOT\Folder\shell\】下新建项,命名为【Run_cmd】,键值改为【Run cmd】。在【Run_cmd】下新建项,
2013-02-20 10:23:56
462
原创 1020 小白鼠:哈夫曼树
1020 小白鼠小白鼠时间限制: 1秒 内存限制: 64MDescription有 n 个瓶子,已知其中有且仅有一个瓶子的饮料有毒。现在我们想知道哪个瓶子的饮料有毒,于是找来一些小白鼠做测试。假设我们有足够多的小白鼠,为了加快测试速度,我们每次可以把来自若干个瓶子的测试样本混在一起,喂给小白鼠。如果小白鼠喝了有毒的饮料,即死。现在给你每个瓶子的饮料有毒的概
2013-02-07 11:05:03
479
原创 1060 Is It A Tree?
1060 Is It A Tree?Is It A Tree?时间限制: 1秒 内存限制: 10240KBDescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes conne
2013-02-06 13:46:34
392
原创 1030 Knight Moves:BFS
宽度优先搜索(BFS)上一次吧DFS错当成BFS写了一篇解题报告,哎呀囧啊。幸好没人发现。言归正传,先上一道例题1030 Knight MovesKnight Moves时间限制: 1秒 内存限制: 64MDescriptionA friend of you is doing research on the Traveling Knight
2013-02-05 13:17:57
416
原创 1038 Red and Black
1038 Red and BlackRed and Black时间限制: 1秒 内存限制: 64MDescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing
2013-02-04 16:31:03
512
1
原创 01背包
动态规划 - 01背包问题描述:给定n种物品和一背包,物品i的重量是wi,其价值是pi,背包的容量是M,问如何选择装入背包中的物品总价值最大?根据公式:Fk(Sk) = opt( Uk ∈ Dk(Sk) , Fk+1(Tk(Sk,Uk),Uk) )可以得到:f[i][j] = max{ f[ i-1 ][ j ] | f[ i ][ j-w[ i ] ] + p[i
2013-02-03 14:25:30
337
原创 1008 Putting Apples
1008 Putting ApplesPutting Apples时间限制: 1秒 内存限制: 64MProblem DescriptionIf we have n apples and k baskets, and we want to put all the apples into the baskets. We can leave some baskets
2013-02-01 16:38:35
426
原创 1003 Exchange for Cola
1003 Exchange for ColaExchange for Cola时间限制: 1秒 内存限制: 64MProblem DescriptionThe Cola company is holding a promotional activity that customerscan exchange B bottles of Cola with A caps
2013-01-31 14:07:12
465
原创 1009 Number Sequence
1009 Number SequenceNumber Sequence时间限制: 1秒 内存限制: 64MProblem DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequen
2013-01-31 12:02:24
415
原创 1007 Number Converter
1007 Number ConverterNumber Converter时间限制: 1秒 内存限制: 64MProblem DescriptionAs we know 3 = 11 if we think about the binary representation . Now let’s make a number converter. Given you
2013-01-30 16:50:01
348
原创 1002 Roman numerals
第一次写解题报告,选了一道目前做过的最简单的题,就当是练手了1002 Roman numerals:http://acm.bit.edu.cn/mod/programming/view.php?a=488Roman numerals时间限制: 1秒 内存限制: 64MProblem DescriptionNow let’s think ab
2013-01-30 11:02:59
741
The GNU General Public License v3.0
2018-04-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人