- 博客(71)
- 资源 (12)
- 收藏
- 关注
原创 并查集删除(转)
并查集的删除---WOJ 1403: Quick Answer 连续想了好几天的题=。=,晚上跟人讨论过后终于AC了.在本题中,需要删除一些元素,而又不希望被删除的元素(记为d)的改变影响到其他和 d 在同一组的元素(比如d是所有同组元素的祖先) 因此可以另外开一个数组 pid[], pid[i]存放的是元素 i 的编号,这个编号在程序运行过程中是逐渐变化的。 当删除了 元素
2010-09-28 22:07:00
2636
原创 POJ 2186 强连通分量
比较简单吧。。套模板。。Gabow#include "cstdlib" #include "cctype" #include "cstring" #include "cstdio" #include "cmath" #include "algorithm" #include "vector" #include "string" #include "iostream" #i
2010-09-27 16:35:00
926
原创 SRM 480 DIV 2
1 水题。。。非常松的限制条件,如果都去掉的话,或许会成为challenge的一道好题 2 非常恶心的问题,一个trick把我给绕进去了。。不能线序的遍历一遍,需要不断设置,不断扩充未完成的集合,并附设标记位 3 又是一道恶心的题目。。。这种1000分的题目,一定不要放弃,不断思考,一定会有结果的。。 This problem can be solved greedily with the following powerful observation. Let X1, X2, X3, ..., XN
2010-08-29 19:21:00
765
原创 IDI Open 2007解题报告
1 A Help Chelsea! Easy 输出一串数的最大值。。这个题目也太无聊了点吧。。 2 G Fridge of Your Dreams Easy 这个题目更无聊,把24位的二进制转化为十进制。。 3 B Virus Medium 先前想法: 可以很容易的想到这个问题是没有数学解的。。因为你必须在前n步中查询才能够获得我下一步的前进方向。只有这些值得到了才能够获得数学解 此时优化的余地就不是很大了。。所以我们采用模拟的解法,保存两个数组,一个是数量数组,一
2010-08-22 22:44:00
862
原创 [Asia - Hefei - 2008/2009][B:Discrete Square Roots][数论基础]
<br /> 看了一下问题,大家可以到ACM/ICPC的那个网站上搞到题目<br />A square root of a number x is a number r such that r2 = x . A discrete square root of a non-negative integer x<br />is a non-negative integer r such that r2 x mod N , 0 r < N , where N is a specific positive i
2010-08-21 18:59:00
850
原创 ZOJ 2313 Andrew Stankevich's Contest #1
<br /> 练一下俄罗斯大牛n年前出的题目。。都饱经风霜,仍然熠熠生辉。。搞个最简单的开个头。。。<br /> http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1313<br /> <br /> 比较简单的一个道题,有一个数学公式需要明确<br /> <br /> m*k % n 如果想要遍历到0-n-1,必要条件是gcd(k,n)=1 ,如果推出了这个公式就是要求1<=k<=N/2的满足这样条件的解。<br /> 下面
2010-08-19 17:51:00
885
原创 VS2008
1 VS中的代码格式化 ctrl+K ->ctrl + F 2 字体是Consolas 9号大小 3 1 字符串 187 53 160 运算符 深蓝色数字 紫色关键字蓝色大括号匹配 加粗 204 39 222
2010-04-28 18:46:00
572
转载 fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾的解决办法
项目从VC6换到VS2003,编译的时候提示如下:logEx.cpp(189) : fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾查了下资料发现,原来是它的头文件中没有引用#include "Stdafx.h"由于这个类是我自已写的,我不打算加入Stdafx.h的引用,所以要做一下修改,如下:1、选中提示出错的文件,这里是logEx.cpp。2、在选中的文件上右键选属
2010-04-28 17:19:00
1736
转载 VS2003 试图运行项目时出错,无法启动调试。没有正确安装调试器。请运行安装程序安装或修复调试器。
运行C:/Program Files/Common Files/Microsoft Shared/VS7Debug下面的mdm.exe /regserver以上运行的命令都是在visual studio .net 命令提示符中输入,并且要进入到上面所说的目录执行才有效。大部分问题都是因为,mdm被损坏了导致的,重新运行最后一条命令就行了。
2010-04-28 16:52:00
800
1
原创 STL set 容易引起误解的一个地方
STL set 容易引起误解的一个地方#include #include #include using namespace std;using std::set;using std::string; struct student { string name; int grade; student(str
2010-04-27 12:29:00
1780
原创 STL SET
STL SETSetSets are a kind ofassociative containers that stores unique elements, and in which the elementsthemselves are the keys.Associative containers are containers especially designed
2010-04-27 12:27:00
2295
原创 ProjectEluer 70
// BEGIN CUT HERE// END CUT HERE#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include
2010-04-08 18:57:00
829
转载 error LNK2019: 无法解析的外部符号 ___glutInitWithExit@12,该符号在函数 _glutInit_ATEXIT_HACK@8 中被引用 1>GEARS.obj : error LNK2019: 无法解析的外部符号 ___gl
opengl的高级菜鸟问题 看了一本书《OpenGL三维图形系统开发与应用技术》,但是,其中涉及到glut.h文件的函数无法正常连接,典型的错误如下:------ 已启动生成: 项目: gears, 配置: Debug Win32 ------1>正在链接...1>GEARS.obj : error LNK2019: 无法解析的外部符号 ___glutInitWithExit@12
2010-03-23 16:03:00
17137
4
原创 C++ struct内存分配大小
C++ struct内存分配大小一 原则:1 所有字段在内存中出现顺序与声明顺序一致 (理论上,译器可以随便放置各个字段)2 由于性能原因,大多数编译器实际上会将struct 的各个字段对齐放置在合适的内存边界。具体细节随着语言编译器和CPU的不同而不同。在80X86体系中,符合Intel应用二进制接口(ABI Application Bianry Interface)的编译器会将
2010-03-21 21:28:00
5653
转载 程序的四种入口方式
程序的四种入口方式 UNICODE Windows : wWinMainCRTStartup UNICODE Console : wmainCRTStartup (如果转换会MBCS,若编译错误,则指定入口)非 UNICODE Windows: WinMainCRTStartup 非 UNICODE Console: mainCRTStartup所以会出现如下的链
2010-03-13 17:27:00
1824
原创 失误呀。。。
这个被我改错了。。不了解实际情况呀。。。有很多lib和dll是用2003封装的。。。。所以这样改是没有结果的。。真崩溃呀。。。 fatal error LNK1104: 无法打开文件“mfc70.lib”方法是一: 点击 project菜单,选择settings...ALT + F7, 在弹出的 project settings 对话框选link标签,在右侧的编辑框中
2010-03-10 14:36:00
1078
转载 不要把MASM32开发环境和MASM汇编器版本搞混了!
MASM32 是一个为那些对学习或者编写 32 位微软汇编( MASM )感兴趣 的程序员提供的工作环境,它最流行的版本是 8.0 版,而我所知道最新版本是 9.0 版。但是请大家一定要注意,这里的 8.0 版和 9.0 版不是指 MASM 编译器 ( 即 ML) 的版本,而是 MASM32 开发环境的版本。 经常看到网上有网友发的贴把这两个概念都搞混了。 那么 MASM(ML) 编译器的版本
2010-03-08 17:35:00
1534
转载 topcoder配置
一般来说,我们安装这三个插件就够了:“FileEdit,CodeProcessor ,TZTester”,把他们下载了之后,放在一个文件夹里面,并且要保证以后不要移动这个文件夹的位置(该文件夹尽量处在桌面路径附近)! 一:登陆arena之后,选择:Options → Editors,调出了新的窗口,按Add在name栏填FileEdit,EntryPoint栏填fileedit.Ent
2010-03-05 10:40:00
1974
1
原创 Codeforces Beta Round #2
转载hhang大牛的blog。。。A – Winner这个比较简单 ,Pass,简单迭代B. The least round way1000*1000的方阵,每个格子有一个非负整数,现在要从左上走到右下,每次只能向下或者向右走。目标是使得所有走的格子里的数的乘积里,末尾0的个数最少,要求输出最有解和走法。不用怎么想也知道基本是个dp了,可以发现其实只有2和5的因子是
2010-02-26 11:44:00
1324
原创 TCHS SRM 31 Problem 500
题目:Problem Statement Its only 9 AM, and already your day has been horrible. You overslept your alarm, your oatmeal got cold as you listened to the traffic report, and the wat
2010-02-24 22:43:00
754
原创 Project Euler Problem 25
有数学方法的一定不用程序方法!!用差分找到斐波那契数列的通项公式,然后列不等式求解=CEILING( (1000 - 1 + LOG10(SQRT(5))) / LOG10((1+SQRT(5))/2),1)这个题目可以扩展一下任意前n位的情况呢。。这个题目可以扩展成为一个acm题目,当然标准解法就是求出通项公式,然后求解
2010-02-19 11:39:00
595
原创 Topcoder SRM 462 DIV 2
第一个问题很弱智。。。EasyPass第二个问题,一开始看到这个问题想入非非了。。很明显高阶方程无解啊。。。想了好久想到了数值解。。。很明显牛顿二分法么。。然后这个没有严格想限制条件就动手了。。期间被精度搞错了一次。。。以后做题注意精度!注意边界条件。。。这个题目fail了好多。。。。。。正杯具啊。。第三题是DP题目,很显然的。#include #include #in
2010-02-18 14:57:00
721
原创 C++ void指针与NULL指针
指针有两个属性:指向变量/对象的地址和长度 但是指针只存储地址,长度则取决于指针的类型 编译器根据指针的类型从指针指向的地址向后寻址 指针类型不同则寻址范围也不同,例如: int*从指定地址向后寻找4字节作为变量的存储单元 double*从指定地址向后寻找8字节作为变量的存储单元void几乎只有“注释”和限制程序的作用 void真正发挥的作用在于:(1) 对函数返回的限定;(2)
2010-01-31 22:06:00
3329
1
转载 棋盘问题
校内转载---->很有意思!Alice和Bob两人玩一种硬币游戏。游戏在一个2*2的棋盘上进行,棋盘上每个格子上都有一枚硬币。在每一回合,Alice可以决定选择翻转某两枚或者一枚硬币,接着Bob可以选择将棋盘旋转90,180或者270度,也可以什么都不做。Alice在整个游戏过程中,不知道游戏刚开始棋盘的状态,也无法看到棋盘上的硬币,甚至不知道Bob每回合是否旋转了棋盘。游戏轮
2010-01-22 17:07:00
994
1
原创 SRM 459 DIV 2
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #i
2010-01-21 14:53:00
662
原创 VS 2008 添加头文件路径!
VS 2008 添加头文件路径 在OpenCV MPICH2 OpenGL中都存在着这个问题,这样子轻松解决! 工程上右键->属性->配置属性->C/C++->附加包含目录
2010-01-16 16:30:00
3265
原创 SRM 458 Div 2
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #i
2010-01-16 13:40:00
709
转载 sprintf的用法
sprintf的功能:将各种类型的数据构造成字符串sprintf 是个变参函数,定义如下:int sprintf( char *buffer, const char *format [, argument] ... );//把整数123 打印成一个字符串保存在s 中。sprintf(s, "%d", 123); //产生"123"可以指定宽度,不足的左边补空格:sprintf(s, "%8d%
2010-01-05 09:44:00
1876
1
原创 SRM 457 Div2 500
非常非常恶心的一个题目。。。想到写了之后基本错误,最后写了半个小时,没弄对。。。感叹啊,这个题怎么这么恶心。今天早晨起床,想起来了。。网上一个,找到了一个异常优美的解答!太强大了!!! 后面附一篇sprintf的用法的文章,有点像C++的istringstream和ostringstream #include #include #include #include
2010-01-05 09:41:00
982
原创 SRM 456
想想上次非常挫啊!!500分愣是没弄明白样例,问题是犯了一个很小的错误!!! 一定要细心! 1000分,又是非常挫。。。很明显的二分。。一定要冷静想清楚问题!!!bless SRM457! 1000分,二分搜索寻找答案! #include #include #include #include #include #include #inclu
2010-01-04 19:10:00
772
原创 Project Euler Problem 17
非常无聊的一个题目!import java.math.*;public class PE15 { /** * @param args */ private static int[] singleWord = { 4, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8 }; privat
2010-01-04 09:49:00
698
原创 Project Euler Problem 15
组合中一个基本问题--->C(40,20)import java.math.*;public class PE15 { /** * @param args */ private static BigInteger combination(int total, int selection) { selection = selection >
2010-01-04 09:34:00
697
原创 Project Euler Problem 14
很简单的一个题目,纯粹暴力解决。而且现在已经证明了此问题不可描述。。。 public class PE14 { /** * @param args */ public static int p14(long n) { int count = 0; while (n != 1) { if (n % 2 ==
2010-01-04 09:10:00
766
原创 Project Euler Problem 32
//很easy的推理得到一定是1*4=4或者3*2=4之类的。(数字代表数的位数)#include #include #include #include unsigned int f(void){ typedef std::set res_set; res_set res; unsigned int digits[9]; unsigned int n1,
2009-12-30 18:17:00
578
原创 Project Euler Problem 31
#include using namespace std;int Pound[]={200,100,50,20,10,5,2,1};int count=0;void Solve(int index, int value){ if(value==0||index==7) { count++; return ; } for(int i=0;i<=valu
2009-12-30 17:37:00
652
原创 Project Euler Problem 16
/*div_tStructure used to represent the value of an integral division performed by div.It has two members of the same type, defined in either order as:int quot; int rem; Members:quot
2009-12-30 16:48:00
537
原创 C++ Templates笔记 8 技巧性基础知识关键字typename
#include #include // print elements of an STL containertemplate void printcoll (T const& coll){ typename T::const_iterator pos; // iterator to iterate over coll typename T::const_iterat
2009-12-30 15:48:00
658
原创 C++ Templates笔记 7 非类型模板参数
#include #include #include #include #include //std::vector 是CONT的缺省值(缺省模板实参)template >class Stack {private: CONT elems; // elementspublic: void push(T const&);
2009-12-30 15:03:00
623
原创 C++ Templates笔记 6 缺省模板实参
#include #include #include #include #include //std::vector 是CONT的缺省值(缺省模板实参)template >class Stack {private: CONT elems; // elementspublic: void push(T const&);
2009-12-30 14:10:00
612
OpenGL模型变换和视图变换
2009-12-08
OpenGL透视变换详解
2009-12-08
OpenGL视口变换
2009-12-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人