码迷,mamicode.com
首页 >  
搜索关键字:while break continue    ( 40024个结果
Qt 的QScriptValueIterator 内容多一项
当使用QScriptValueIterator 时,遍历的内容发现多了一项 。看了文档,找到了解决办法,在it.nex()后面添加if (it.flags() & QScriptValue::SkipInEnumeration) ? ? ? ? ?continue; 具体参考文档。http://qt...
分类:其他好文   时间:2014-07-25 11:40:31    阅读次数:226
hdu 2602 Bone Collector
开始变量竟然输反了#include #include int dp[1002]; struct none { int vo; int value; }a[1002]; int max(int a,int b) {return a>b?a:b;} int main() { int N,V,T,i,j; scanf("%d",&T); while(T--) { sc...
分类:其他好文   时间:2014-07-25 11:28:01    阅读次数:203
uva 548(二叉树)
题解:给出了二叉树的中序和后序,重建二叉树,输出路径和最短的叶子的值。 两个模板: 给出前序和中序建树: Node* build (int n, int* preo, int* ino) { Node* node = new Node; int i = 0; if (n <= 0) return NULL; while (ino[i] != p...
分类:其他好文   时间:2014-07-25 11:26:21    阅读次数:175
Codeforces Round #258 (Div. 2/A)/Codeforces451A_Game With Sticks
解题报告 n和m跟木棍相交,问一人取一交点(必须是交点,且取完后去掉交点的两根木棍),最后谁赢 思路: 取最大正方形,以对角线上的交点个数判断输赢。 #include #include using namespace std; int main() { int m,n; while(cin>>n>>m) { if(n>m) {...
分类:其他好文   时间:2014-07-25 11:18:01    阅读次数:288
break键
键盘上一直与个break键,不知道干什么的。今天终于发现了一个和break键相关的功能,那就是:使用“Windows键”+“Break键”可以打开系统属性,相当于右击“我的电脑”,选择“属性”。以后可以一键打开我的电脑属性了,哈哈!
分类:其他好文   时间:2014-07-24 23:53:04    阅读次数:203
USACO Section 2.1 Healthy Holsteins
/* ID: lucien23 PROG: holstein LANG: C++ */ #include #include #include using namespace std; bool compFun(int x, int y) { int temp, i = 0; while (true) { temp = 1 < temp&y...
分类:其他好文   时间:2014-07-24 23:11:33    阅读次数:433
P77
#include main() { int x=1,y=0,a=0,b=0; switch(x) { case 1: switch(y) { case 0:a++;break; case 1:b++;break; } case 2:a++;b++;break; case 3:a++;b++; } printf("%d,%d\n",a,b); }...
分类:其他好文   时间:2014-07-24 23:06:53    阅读次数:217
P77 ~
#include int q1,q2,q3; void fun(long n) { q1=q2=q3=0; while(n) { switch(n%10) { case 1:q1++;break; case 2:q2++;break; case 3:q3++; } n/=10; } } main() { long n=123451123; fun(n); ...
分类:其他好文   时间:2014-07-24 23:04:43    阅读次数:271
剑指Offer:二进制中1的个数
题目:输入一个整数,输出该数二进制表示中1的个数。// 二进制中1的个数#include int wrong_count_1_bits(int n) // 错误解法: 当n为负数时, n>>=1右移, 最高位补1, 陷入死循环{ int count = 0; while(n) { ...
分类:其他好文   时间:2014-07-24 22:33:42    阅读次数:221
switch 与 whille相互套用
一直自以为还比较了解C++,这两天写个小工具结果出现了个bug,查了几个小时。现在才发现我这么水。switch是C++后来推出了,目的在于提高代码结构清晰度。但是switch与while连用时是有坑的。 1 #include 2 #include 3 4 int main() 5 { 6 ...
分类:其他好文   时间:2014-07-24 22:17:32    阅读次数:236
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!