码迷,mamicode.com
首页 >  
搜索关键字:while break continue    ( 40024个结果
编程之美 2.1 求二进制数中1的个数
假设有数n 以前用除二取余法 复杂度logn 不多说 有一个logv的方法 v为1的个数 复杂度比logn小   int Count(int x) { int ans = 0; while(x) { x &= (x-1); ans++; } return ans; } 这里用到了位运算  x&(x-1)每次去掉一个1 举个例子  100010001000&(10...
分类:其他好文   时间:2014-07-31 20:55:27    阅读次数:225
hdu 1052 田忌赛马
贪心,排序从大到小。。 先比大的,跑不过就拿最小的来送死。。, 如果是平局就比后面的。。。 若后面也是平局就拿去跟前面的去跑。。。 #include #include #include #include using namespace std; int s[1005],w[1005]; int main() {     int n,i;     while(scanf("...
分类:其他好文   时间:2014-07-31 20:50:47    阅读次数:153
循环语句
PL/SQL有四种类型的循环:简单循环、WHILE循环、FOR循环以及游标FOR循环。在这里我们主要讨论前三种,除此之外,还将讨论Oracle 11g中新引入的CONTINUE语句。
分类:其他好文   时间:2014-07-31 20:25:17    阅读次数:279
Oracle Multitenant Environment (三) Plan for a cdb
Below tables contains contant you need to consider while planning for a CDB.ActionConsiderations for a CDBAdditional InformationPlan the tables and in...
分类:数据库   时间:2014-07-31 20:06:07    阅读次数:401
素数判定
Problem Description对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39int main(){ int x,y,i,n,t,flag; while(scanf("%d%d",&x,&y)!=EOF&&(x!=0||y!=0))//又学会了一招·...
分类:其他好文   时间:2014-07-31 19:52:57    阅读次数:252
把字符串转化成整型显示
用法./change 23456 10, 按最后指定的进制显示 #include #include #include int mystrlen(char *s) {    int len=0;    char *temp=s;    while(*(temp)!='\0')    {       ++len;       ++temp;    }    return le...
分类:其他好文   时间:2014-07-31 16:57:06    阅读次数:224
hdoj 1087 (DP)
代码:#include #include using namespace std; int a[1005], dp[1005]; int main() { int n,sum,i,j; while( scanf("%d",&n)&&n){ for( i=0; ia[j]) dp[i]=max...
分类:其他好文   时间:2014-07-31 16:42:26    阅读次数:151
不定参数的格式化
#include#includestd::string formatt(const char * format,...){ va_list args; (void)va_start(args,format); std::string retstr; size_t size = 1024; while...
分类:其他好文   时间:2014-07-31 16:23:06    阅读次数:187
leetcode--009 Linked List Cycle I
1 public boolean hasCycle(ListNode head) { 2 ListNode s=head; 3 ListNode f=head; 4 while(f!=null&&f.next!=null){ 5 ...
分类:其他好文   时间:2014-07-31 16:14:27    阅读次数:223
leetcode--007 word break I
注意:不一定是一分为2 1 package leetcode; 2 3 import java.util.Set; 4 5 public class WordBreak11 { 6 public boolean wordBreak(String s, Set dict) { 7 ...
分类:其他好文   时间:2014-07-31 16:11:16    阅读次数:171
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!