现在位置: 首页 > more0007发表的所有文章
  • 08月
  • 17日
综合 ⁄ 共 716字 评论关闭
题目链接:hdu 4970 Killing Monsters 题目大意:在长度为N的路上,有M个攻击塔,给定M个攻击台的攻击范围和伤害,现在有Q只怪物,给出Q只怪物的HP和出现位置,怪物固定向右进攻,问所有有多少只怪物活着。 解题思路:对于攻击台,l,r,val,在v[l]处加上val,v[r+1]处减掉val。然后遍历一遍v数组递推出各个点的伤害。并且处理处伤害的前缀和。然后对于每只怪物去判断。 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 1e5+5; typedef unsigned long l......
阅读全文
  • 08月
  • 09日
综合 ⁄ 共 336字 评论关闭
  在MyEclipse6.0的快捷键中把我们习惯性使用的Alt+/进行代码自动补齐的快捷键改为了ctrl+空格,大家知道这是我们切换中英文输入法的键,所以我们需要更改这个快捷键,方法如下:1.选择MyEclipse6.0菜单栏中的Window->preferences;2.选择General->keys;3.在右侧中间的窗体中点击word completion后再点击remove binding,在下方的binding中随便输入一个快捷键;4.然后选择Content Assist点击Remove binding,在binding中输入Alt+/或Ctrl+/;5.点击Ok就可以了。 似乎也太复杂了,主要是为了防止快捷键冲突,其实直接修改Co......
阅读全文
  • 05月
  • 16日
综合 ⁄ 共 6657字 评论关闭
环境是xcode4.3 首先要弄懂几个基本的概念。 一)三个结构体:CGPoint、CGSize、CGRect 1.  CGPoint /* Points. */          struct CGPoint {       CGFloat x;       CGFloat y;     };     typedef struct CGPoint CGPoint;   看到这个想必你已经懂了,不再解释。 2.  CGSize /* Sizes. */          struct CGSize {       CGFloat width;       CGFloat height;     };     typedef struct CGSize CGSize;    不解释。 3.CGRect /* Rectangles. */          struct CGRect {       CGPoin......
阅读全文
  • 05月
  • 12日
综合 ⁄ 共 83字 评论关闭
        昨天用Vmware在Mac中安装了Ubuntu 14.04,感觉还是不错的。用Parallels安装后启动,分辨率不可调,800*600,果断转到Vmware。
阅读全文
  • 04月
  • 08日
综合 ⁄ 共 1180字 评论关闭
受此文启发: http://www.cnblogs.com/pushing-my-way/archive/2012/08/23/2652033.html   用链式表实现拓扑排序,我这里用的是栈,当然队列也是可以的。   #include<iostream> #include<cstring> #include<stack> using namespace std; int rudu[27],map[27][27],list[27]; int toposort(int n) { bool flag; int i,j,rudu1[27],temp1; stack<int>s1; memcpy(rudu1,rudu,sizeof(rudu1)); for(i=1;i<=n;i++) if(rudu1[i]==0) s1.push(i); i=0; flag=0; while(s1.size()!=0) { if(s1.size(......
阅读全文
  • 03月
  • 15日
综合 ⁄ 共 884字 评论关闭
最近研究了一下经济学,用程序员的严密逻辑思维来观察,发现一些惊人的事实: 1.GDP=产量*单价,产量没变,单价上涨,GDP也会上涨。 2.为了防止失业,也就是让国民有活干,就要增加需求,表面上向市场投入货币,可以拉动内需,事实上,长期来看,会让物价上涨。这意味着,民众存在银行的钱,购买力下降了,而实产,例如房产,价格会上涨,也就是会升值。这就形成了资源再分配:穷人更穷,富人更富。而这样又会推导出更加惊人的事实:国家不需要向民众收税,只要印钞票,就等于变相税收。这其实就是掠夺。 3.如何破解这一困局?仔细......
阅读全文
  • 02月
  • 21日
综合 ⁄ 共 3352字 评论关闭
Paint the Grid Again Time Limit: 2 Seconds      Memory Limit: 65536 KB Leo has a grid with N × N cells. He wants to paint each cell with a specific color (either black or white). Leo has a magical brush which can paint any row with black color, or any column with white color. Each time he uses the brush, the previous color of cells will be covered by the new color. Since the magic of the brush is limited, each row and each column can only be painted at most once. The cells were painted ......
阅读全文
  • 02月
  • 09日
综合 ⁄ 共 1560字 评论关闭
JS中的匿名函数的用法及优缺点 匿名函数可以有效的保证在页面上写入Javascript,而不会造成全局变量的污染。 这在给一个不是很熟悉的页面增加Javascript时非常有效,也很优美。 一、什么是匿名函数? 在Javascript定义一个函数一般有如下三种方式: 函数关键字(function)语句: function fnMethodName(x){alert(x);} 函数字面量(Function Literals): var fnMethodName = function(x){alert(x);} Function()构造函数: var fnMethodName = new Function('x','alert(x);') 上面三种方法定义了同一个......
阅读全文
  • 02月
  • 02日
综合 ⁄ 共 2433字 评论关闭
《UNP》中源代码的编译和使用 (2010-10-16 21:13)转载   分类: 网络相关    最近看了下《UNIX网络编程》,就想把里面的源代码搞过来运行下。以前也搞过,不过老是忘记使用代码的步骤了,所以就记录下,防止每次还要弄半天。    从网上下载压缩包解压到自己设定的目录下面,我的是/home/**/myprogram/UNP/unpv13e/,里面有   ./    ├── aclocal.m4    ├── advio    ├── bcast    ├── config.guess    ├── config.h    ├── config.h.in    ├── config.log    ├── config.status    ├── config.sub    ├── configure    ├── confi......
阅读全文
  • 02月
  • 01日
综合 ⁄ 共 5010字 评论关闭
  通过WMI来实现获取客户端计算机硬件及系统信息: 1//系统信息获取 2function getSysInfo(){ 3 var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); 4 var service = locator.ConnectServer("."); 5 //CPU信息 6 var cpu = new Enumerator (service.ExecQuery("SELECT * FROM Win32_Processor")).item(); 7 var cpuType=cpu.Name,hostName=cpu.SystemName; 8 //内存信息 9 var memory = new Enumerator (service.ExecQuery("SELECT * FROM Win32_PhysicalMemory")); 10 for (......
阅读全文
今天发布Web项目,结果运行出错,错误信息如下: [COMException (0x800736b1): 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。 (Exception from HRESULT: 0x800736B1)] [FileLoadException: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。 (Exception from HRESULT: 0x800736B1)] 在......
阅读全文
  • 12月
  • 24日
综合 ⁄ 共 2220字 评论关闭
After clicking the button that initiates the download, Android will give your application no more than a few seconds to respond to that input event. Otherwise, it’ll kill it and raise the previously mentioned ANR exception. For BroadcastReceivers, Android is more forgiving and waits longer before pulling the plug, but it also monitors their execution time. SimpleImageDownload.java uses java.lang.Thread to download an image file: public class SimpleImageDownload extends Activity { priv......
阅读全文