码迷,mamicode.com
首页 >  
搜索关键字:for while until    ( 29426个结果
poj 1611 The Suspects
并查集 简单题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] >= 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(i...
分类:其他好文   时间:2014-07-23 11:59:06    阅读次数:227
hdu 1232
并查集 入门题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] > 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(in...
分类:其他好文   时间:2014-07-23 11:58:18    阅读次数:169
1、打印二进制机器码,程序内存分析,大端序小端序,指针数组,数组指针,数组的三种访问方式,typedef,#if-0-#endif,求数组大小,括号表达式
?? 1.打印二进制机器码(分别表示32位的和64位的) #include   /*按照8位的长度打印一个数值*/ void dis8bit(char val) {    int bit = 8;    while(bit--)     {        if(1            printf("1");      ...
分类:其他好文   时间:2014-07-22 23:48:57    阅读次数:408
leetcode reverse integer
public class Solution { public int reverse(int x) { int ret=0; while(x!=0) { int t=x%10; ret=ret*10+t; ...
分类:其他好文   时间:2014-07-22 23:25:57    阅读次数:213
10055 - Hashmat the Brave Warrior
#include#include#include#includeusing namespace std;//typedef __int64 lld;typedef long long lld;int main(){ lld n,m,ans; //while(scanf("%I64d%I6...
分类:其他好文   时间:2014-07-22 23:19:07    阅读次数:194
Perl
my $line; my $content; open (FN,"D:\\PerlDemo\\parse.xml") or die "not found $!"; while($line=){ next if $. < 5; last if $. >10; $content.=$line; } close(FN); print "$content \n"; my $K=; my @R =qw...
分类:其他好文   时间:2014-07-22 22:37:53    阅读次数:225
卡片游戏(队列)
#include #include using namespace std; queueq; int main() { int n; cin>>n; for(int i=1;i<=n;i++) q.push(i); while(!q.empty()) { cout<<q.front()<<' '; q.pop(); if(!q.empty()) ...
分类:其他好文   时间:2014-07-22 22:34:33    阅读次数:179
P64
#include void fun(long s,long *t) { int d; long s1=1; *t=0; while(s>0) { d=s%10; if(d%2!=0) {*t=d*s1+*t; s1*=10; } s/=10; } } void main() { long s,t; printf("\nPlease enter:"); sc...
分类:其他好文   时间:2014-07-22 22:34:12    阅读次数:201
D. Multiplication Table 二分查找
刚做这道题根本没想到二分,最关键是没想出来如何统计在这个矩阵中比一个数小的有几个怎么算,造成自己想了好久最后看了别人的提示才做出来。哎!好久不做题太弱了 #include #include using namespace std; int main(){ // freopen("in.txt","r",stdin); long long n,m,k; while(cin>>...
分类:其他好文   时间:2014-07-22 22:33:55    阅读次数:192
zoj1970||poj 1936 All in All
注意细节,一直把Yes,写成YES,找错误找了老半天都找不出来。。。。 代码如下:#include #include int main() { char s[100005],t[100005]; int m,i,j,n; while(scanf("%s%s",s,t)!=EOF) { m=strlen(t); n=strlen(s); i=0; f...
分类:其他好文   时间:2014-07-22 17:59:41    阅读次数:201
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!