码迷,mamicode.com
首页 >  
搜索关键字:for while until    ( 29426个结果
一周总结2
在c语言中,循环语句是重难点。,掌握while与do-while的区别以及条件,for循环的三个表达式。break表示结束本层循环,continue是结束本次循环,进行下次循环。数组与字符串的冒泡排序基本表达式为int i,j;int a[5];int med;for(i=0;i<5;i++){ f...
分类:其他好文   时间:2014-06-04 14:57:26    阅读次数:200
Iterative Algorithm
An iterative algorithm takes one step at a time, ensuring that each step makes progress while maitining the loop invariant.A paradigm shift:View an al...
分类:其他好文   时间:2014-06-02 19:20:20    阅读次数:286
【剑指offer】无聊的1+2+...+n
题目描述: 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 输入: 输入可能包含多个测试样例。 对于每个测试案例,输入为一个整数n(1<= n<=100000)。 输出: 对应每个测试案例, 输出1+2+3+…+n的值。 样例输入:...
分类:其他好文   时间:2014-06-02 10:36:56    阅读次数:204
1+2+3+...+n不能用while、for、if else等实现
问题描述 求 1+2+ … +n ,要求不能使用乘除法、 for 、 while 、 if 、 else 、 switch 、 case 等关键字以及条件判断语句。 实际意义不大,题目涉及的知识还是不错的! 方法1 用构造函数求解。 #include using namespace std; class Plus { public: Plu...
分类:其他好文   时间:2014-06-02 10:29:11    阅读次数:208
poj2864
1 #include 2 #include 3 #include 4 using namespace std; 5 int main () 6 { 7 int n,m; 8 while(scanf("%d %d",&m,&n)&&m&&n) 9 {10 in...
分类:其他好文   时间:2014-06-02 06:25:12    阅读次数:158
执行srvctl报错 :error while loading shared libraries: libpthread.so.0:
执行srvctl是报错 errorwhileloadingsharedlibraries:libpthread.so.0: [oracle@rac02~]$srvctl /opt/ora10g/product/10.2.0/db_1/jdk/jre/bin/java:errorwhileloadingsharedlibraries:libpthread.so.0: cannotopensharedobjectfile:Nosuchfileordirectory 查看srvctl命令..
分类:其他好文   时间:2014-06-02 04:09:00    阅读次数:285
AIX脚本创建裸设备
1.批量建立redolog裸设备脚本(非条带) #!/usr/bin/ksh i=1 while(($i<=9)); do mklv-ylv_redo"00$i"_1g-traw-wn-rn-u1oltpvg1 i=$(expr$i+1); done 2.建立stripesize为1M,stripewidth为14,lv大小为8G的裸设备, hdiskpower1=92160M #!/usr/bin/ksh i=1 while[$i-lt..
分类:其他好文   时间:2014-06-02 03:05:19    阅读次数:281
LeetCode Sort Colors
class Solution { public: void swap(int &a,int &b) { int t=a; a=b; b=t; } void ksort(int l,int h,int a[]) { if(h<l+2) return; int e=h,p=l; while(...
分类:其他好文   时间:2014-06-02 03:01:26    阅读次数:206
【leetcode】N-queens II
问题: 返回N皇后问题解的个数。 分析: 详见 N-queens 实现: bool nextPermutation(vector &num) { int i = num.size() - 1; while (i >= 1) { if(num[i] > num[i - 1]) { --i; int ii = num.size() - 1; while (i...
分类:其他好文   时间:2014-06-01 18:24:45    阅读次数:398
lua 语句学习
就如同C里的if else,while,do,repeat;就看lua里怎么用: 1、首先看if else t = {1,2,3} local i = 1 if t[i] and t[i] % 2 == 0 then print("even") else print("odd") end lua木有C里的&&,而是and来表示;if 之后跟表达式,之后要更个then 最后语句结束都要...
分类:其他好文   时间:2014-06-01 18:13:48    阅读次数:567
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!