现在位置: 首页 > Alietslig发表的所有文章
  • 06月
  • 08日
综合 ⁄ 共 2201字 评论关闭
_exit终止调用进程,但不关闭文件,不清除输出缓存,也不调用出口函数。 exit函数将终止调用进程。在退出程序之前,所有文件关闭,缓冲输出内容 将刷新定义,并调用所有已刷新的“出口函数”(由atexit定义)。 作为系统调用而言,_exit和exit是一对孪生兄弟,它们究竟相似到什么程度,我们可以从Linux的源码中找到答案: #define __NR__exit __NR_exit     "__NR_"是在Linux的源码中为每个系统调用加上的前缀,请注意第一个exit前有2条下划线,第二个exit前只有1条下划线。 这时随便一个懂得C语言并且头脑清醒的人都会说......
阅读全文
  • 05月
  • 03日
综合 ⁄ 共 40字 评论关闭
网址:http://www.w3school.com.cn/index.html
阅读全文
  • 04月
  • 25日
综合 ⁄ 共 903字 评论关闭
#include<algorithm> #include<iostream> #include<cstring> #include<cstdlib> #include<cstdio> #define inf 0x7fffffff using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } struct data{ int x,y; }q[1000001]; const int xx[4]={-1,1,0,0},yy[4]={0,0,1,-1}; int x,y,n,s[1010][1010]; bool mp[1010][1......
阅读全文
  • 04月
  • 16日
综合 ⁄ 共 5028字 评论关闭
在android4.2中,Google更换了android的蓝牙协议栈,从Bluez换成Bluedroid,我也是初涉这个方面,顺便记录一下。http://source.android.com/devices/bluetooth.html android development对于4.3蓝牙的介绍: android提供BlueDroid作为默认的协议栈,BlueDroid分为两个部分: 1、Bluetooth Embedded System(BTE),它实现了BT的核心功能。 2、Bluetooth Application Layer (BTA),用于和android framework层交互。 BT 系统服务通过JNI与BT stack交互,并且通过Binder IPC通信与应用交互。这个系统服务同时也提供给RD获取不同......
阅读全文
  • 04月
  • 03日
综合 ⁄ 共 1211字 评论关闭
求树的直径 #include <stdio.h> #include <string.h> const int MAXN = 100010; struct node { int to, next; }data[MAXN*2]; int head[MAXN], n, m, sz; void add(int u, int v) { data[sz].to = v; data[sz].next = head[u]; head[u] = sz++; data[sz].to = u; data[sz].next = head[v]; head[v] = sz++; } int fnum[MAXN], snum[MAXN], cnt[MAXN]; void dfs(int u, int pre) { int v, i; fnum[u] = snum[u] = 0; for (i = head[u]; ~i; i=data[i].next) { if ( (v=data[i].to) == pre) continue; ......
阅读全文
  • 03月
  • 17日
综合 ⁄ 共 1729字 评论关闭
题意:给个一只有0,1 的序列,有以下5种操作 0 a b change all characters into '0's in [a , b] //把a,b间的都改为0 1 a b change all characters into '1's in [a , b] //把a,b间都改为1 2 a b change all '0's into '1's and change all '1's into '0's in [a, b] //1的改为0,0的改为1 Output operations: 3 a b output the number of '1's in [a, b]  //a,b间1 的数量 4 a b output the length of the longest continuous '1' string in [a , b]//a,b间最大连续的1的个数 思路:经典的线段树,只是操作过多,但其实......
阅读全文
  • 03月
  • 17日
综合 ⁄ 共 1314字 评论关闭
 在背景为0的画面使用4联。当填充时遇到‘1’表示遇到一个图形元素 计数+1 此时对´1´进行8联填充,目的是把一个完整图形元素做访问标记,这样再遇到该图形元素就不会重复计数 再返回,继续对背景4联填充。 原先用floodfill给封闭的图的边涂色,再深搜 看有多少个不同的连通图 结果wrong了  后来发现,原来是递归里,栈和队列调用太深,栈溢出了,得自己来栈!! #include "stdio.h" #define M 1005 char map[M][M]; int dx0[] = {-1,0,1,0}; int dy0[] = {0,-1,0,1}; int dx[] = {-1,-1,0,1,1,1,0,-1}; int dy[] = {0,-1,-1,-1,0......
阅读全文
  • 02月
  • 23日
综合 ⁄ 共 2557字 评论关闭
思路:先找到1到n的所有最短路径上的边,然后在这些边中间找边双连通桥即为答案。 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> #include<queue> #include<set> #include<stack> #define maxn 1<<29 using namespace std; struct edge { int from,to; long long len; }; struct ed { int u,v; }; struct node { int ve; long long dis; }; vector<edge>edges; stack<int>st; vector<......
阅读全文
  • 02月
  • 22日
综合 ⁄ 共 951字 评论关闭
问题描述 如下图所示,3 x 3 的格子中填写了一些整数。 +--*--+--+ |10* 1|52| +--****--+ |20|30* 1| *******--+ | 1| 2| 3| +--+--+--+ 我们沿着图中的星号线剪开,得到两个部分,每个部分的数字和都是60。 本题的要求就是请你编程判定:对给定的m x n 的格子中的整数,是否可以分割为两个部分,使得这两个区域的数字和相等。 如果存在多种解答,请输出包含左上角格子的那个区域包含的格子的最小数目。 如果无法分割,则输出 0。 输入格式 程序先读入两个整数 m n 用空格分割 (m,n<10)。 表示表格的宽度和高度......
阅读全文
  • 02月
  • 13日
综合 ⁄ 共 2384字 评论关闭
虽然iOS 5.0版本之后加入了ARC机制,由于相互引用关系比较复杂时,内存泄露还是可能存在。所以了解原理很重要。 这里讲述在没有ARC的情况下,如何使用Instruments来查找程序中的内存泄露,以及NSZombieEnabled设置的使用。 本文假设你已经比较熟悉Obj-C的内存管理机制。 实验的开发环境:XCode 4.5.2 1、运行Demo。 先下载一个实现准备好的内存泄露的Demo吧:leak app 下载下来,打开运行,程序是一个寿司的列表,列出各种寿司卷。试着选择里面的几行,应该是选第二行的时候就崩溃了。崩溃截图: 在崩溃的地方断住了......
阅读全文
  • 01月
  • 13日
综合 ⁄ 共 1391字 评论关闭
#include<iostream> #include<cstdio> #define inf 1000000000 using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-')f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x*f; } const int maxn = 100005, maxm = 1800000; int n, m, k, sz, root[maxn], fa[maxn], v[maxn], id[maxn], ls......
阅读全文
  • 01月
  • 10日
综合 ⁄ 共 250字 评论关闭
公司要使用mongodb来进行开发,但是springframework用的是3.0.2,经过不断的error信息,终于找到了springframework3.0.2下可以运行的jar包: spring-data-commons-core-1.1.0.M1.jar; spring-data-document-core-1.0.0.M2.jar; spring-data-mongodb-1.0.0.M2.jar; 可能是版本的问题,其它的组合都或多或少会出现一下问题 如果哪位有更好的组合的解决方案,给我一份。
阅读全文