码迷,mamicode.com
首页 >  
搜索关键字:do ... while 循环    ( 74622个结果
走进C标准库(8)——"string.h"中函数的实现相关字符串操作函数
我的strcat: 1 char *strcat(char *dest,char *src) 2 { 3 char * reval = dest; 4 while(*dest) 5 dest++; 6 while(*src) 7 *dest++...
分类:其他好文   时间:2014-05-01 08:59:02    阅读次数:484
uva 11988 这题可以看出c++中string效率的底下
用c语言实现 #include #include #include using namespace std; typedef struct node { char x; struct node *next; }chan; chan *root = new chan; char a[100010]; int main() { while(scanf("%...
分类:编程语言   时间:2014-04-29 13:47:20    阅读次数:358
UVA 617 - Nonstop Travel(数论+暴力枚举)
题目链接:617 - Nonstop Travel 题意:给定一些红绿灯,现在速度能在30-60km/h之内,求多少个速度满足一路不遇到红灯。 思路:暴力每一个速度,去判断可不可以,最后注意下输出格式即可 代码: #include #include #include const double esp = 1e-6; int n, vis[105]; struct D { do...
分类:其他好文   时间:2014-04-29 13:45:20    阅读次数:333
Leetcode:Reorder List 单链表重排序
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it to ...
分类:其他好文   时间:2014-04-29 13:42:21    阅读次数:427
Win32 线程的创建&信号量临界资源&事件对象
背景: 写了个程序,主要实现的功能为主线程创建两个子线程,之后主线程进入等待事件的循环。子线程1对临界资源cnt的值减2并输出cnt的值。子线程2对cnt的值加1并输出cnt的值,且当cnt为50的时候触发事件对象hend_even,子进程2退出。主线程收到hend_even后杀死子线程1,之后进入scanf阻塞。。。 代码示例: #include #include DWORD WIN...
分类:编程语言   时间:2014-04-29 13:31:21    阅读次数:377
链表《2》使用函数操作链表
使用函数操作链表 1:计算链表中结点的个数:定义一个Length_list()函数用于计算链表中结点的个数 函数代码: //计算链表中结点的个数 void Length_list(PNODE pHead) { PNODE p = pHead->pNext; int len = 0; while(NULL != p) { len++; p = p->pNext; ...
分类:其他好文   时间:2014-04-29 13:28:21    阅读次数:302
ZOJ 2588 Burning Bridges 求无向图桥 边双连通裸题
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1588 #include #include #include #include #include using namespace std; #define N 10050 #define M 200005 int n,m;//n个点 m条边 struct Edge{...
分类:其他好文   时间:2014-04-29 13:25:21    阅读次数:383
树莓派玩家需要的X条核心品格
本文只是作者本人在混迹于树莓派相关的论坛贴吧良久后的一些感想。纯属个人观点,限于本人能力有限,难免有所偏颇,还望斧正。 在能想到的所有品格中我认为最重要的就是这个: LIY / TIY / DIY Learn it yourself / Try it yourself / Do it yourself, 自己学、自己试、自己做。麻雀虽小五脏俱全,树莓派是一个复杂的系统,涉及到...
分类:其他好文   时间:2014-04-29 13:23:20    阅读次数:300
leetcode day6 -- String to Integer (atoi) && Best Time to Buy and Sell Stock I II III
1、 ?? String to Integer (atoi) Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yours...
分类:其他好文   时间:2014-04-29 13:22:22    阅读次数:341
wustoj 1318 区间的连通性 (最短路)
floyd求最短路。 注意图是有向图。。。 #include #include #include using namespace std; struct node { int x,y,id; }edge[205]; int dis[205][205]; int main() { int c,T,n,a,b,op; while(scanf("%d",&T...
分类:其他好文   时间:2014-04-29 13:21:23    阅读次数:313
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!