线程停止的方法: 记住一点,线程的停止, 1.自己运行完了, 2.如果是无限循环,在外部,只能用flag标记来操作。 但是当线程处于冻结状态(阻塞),sleep,wait,join,(这三个方法抛出异常。) 就不会读取到flag. 这个时候,我们要清除线程的冻结状态,让它回到运..
分类:
编程语言 时间:
2014-09-10 03:00:00
阅读次数:
219
在我们程序代码中时常会有这样一种操作 (一个button点击一次触发一个状态当再一次点击button触发另一个事件循环交互两个事件)我们可以这样简单的操作:首先设置一个全局变量 BOOL 类型:flag;if(flag==0){write code //第一次单击button触发的事件flag=1....
分类:
其他好文 时间:
2014-09-10 00:15:09
阅读次数:
267
# include
# include
# include
# include
# include
# define MAX 15
using namespace std;
typedef struct Trie_Node
{
bool flag;//是否有子树
struct Trie_Node *next[MAX];
}Trie;
void Insert(Trie *r...
分类:
其他好文 时间:
2014-09-09 20:11:09
阅读次数:
234
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".字符串相加,不难个人思路:1,尾部对齐,然后逐位相加,flag记为进位代码: 1 #inclu...
分类:
其他好文 时间:
2014-09-09 15:26:58
阅读次数:
213
一、冒泡排序基本思想是:两两比较相邻记录的关键字,如果反序则交换冒泡排序时间复杂度最好的情况为O(n),最坏的情况是O(n^2)改进思路1:设置标志位,明显如果有一趟没有发生交换(flag = false),说明排序已经完成改进思路2:记录一轮下来标记的最后位置,下次从头部遍历到这个位置就Ok二、直...
分类:
其他好文 时间:
2014-09-09 15:19:18
阅读次数:
190
//校验特殊字符 function _checkCharacter(string){ var flag = ""; var regLegal = /^[a-zA-Z0-9\.,の:%![]【】~\u4e00-\u9fa5]*$/, //必须包含这些字符 ...
分类:
其他好文 时间:
2014-09-09 12:17:48
阅读次数:
163
#include #include #include void GetNext(int *next, char *str){ int len = strlen(str); int i, k, flag = 1; next[0] = -1; for(i = 2; i < len; i++) //nex...
分类:
其他好文 时间:
2014-09-09 11:02:28
阅读次数:
184
flag = 1while 1: flag = flag + 1 if flag > 10: break try: f = open("file-not-exists", "r") except IOError,e: print(...
分类:
编程语言 时间:
2014-09-05 19:46:31
阅读次数:
232
Intent intent= new
Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
Context对象.star...
分类:
移动开发 时间:
2014-09-05 00:59:00
阅读次数:
210
【题意简述】:中文题
【分析】:想法很简单,因为n的范围仅仅是 2
不过要注意这里边表的那个上线,我们可以试出来,最后我测试出的结果是5000左右。
#include
using namespace std;
int a[5000]={0};
int main()
{
int n,i,j,m,flag=0;
a[0]=1;a[1]=1;
for(i=2;...
分类:
其他好文 时间:
2014-09-04 19:05:10
阅读次数:
163