码迷,mamicode.com
首页 >  
搜索关键字:if then else    ( 23991个结果
找出字符串中第一个只出现一次的字符
find the first unique character in  a string and you can just traverse this string only one time. if there is no such character, just return '#' and '#' will not appear in the string, else return the ...
分类:其他好文   时间:2015-04-21 22:53:16    阅读次数:167
例题:把机选双色球做成函数题。public定义函数,可以定义多种类型,也可以定义集合,学习函数题多一种方法。
public ArrayList jixuanqiu(ArrayList red) //定义一个集合类型的函数 { Random r = new Random(); //机选6个红球的过程并排序 while (true) { if (red.Count == 6) { break; } else {...
分类:其他好文   时间:2015-04-21 22:23:35    阅读次数:132
BZOJ-3224 普通平衡树
一道BST的练习题。Treap版:#include #include #include #include #include #include #define rep(i, l, r) for(int i=l; i pr[v]) Right(v); } else { Insert(x, r[v]).....
分类:其他好文   时间:2015-04-21 22:15:51    阅读次数:142
BZOJ-2733 永无乡
Treap+启发式合并。依旧没什么需要用到脑子的。#include #include #include #include #include #include #define rep(i, l, r) for(int i=l; i pr[u]) Right(u); } else { if (!r[.....
分类:其他好文   时间:2015-04-21 22:11:08    阅读次数:127
HDU ACM 1029-Ignatius and the Princess IV
分析:互相抵消,最后不能被抵消的就是最多的。 #include using namespace std; int main() { int n,a,i; int ans,sum; while(cin>>n) { for(i=0;i>a; if(i==0) { sum=1; ans=n; } else i...
分类:其他好文   时间:2015-04-21 20:45:12    阅读次数:104
Java流程控制
----判断结构if1.if(条件表达式){执行语句;}2.if(条件表达式){执行语句;}else{执行语句;}3.if(条件表达式){执行语句;}elseif(条件表达式){执行语句;}……else{执行语句;}----选择结构switchswitch(表达式){case取值1:执行语句;break;case取值2:执行语句;break;…...d..
分类:编程语言   时间:2015-04-21 18:30:39    阅读次数:122
用数组求一位数组中的最大值,最小值和平均分,并求出有多少个数超过平均分
#include main() { int a=0,b,n,i,j,s[100],max,min,w; scanf("%d",&n); w=0; for(i=0;i scanf("%d",&s[i]); max=s[0]; for(i=1;i if(max max=s[i]; //else {max=s[i+1];min=s[i];}} min=s[0]; for(i=...
分类:编程语言   时间:2015-04-21 18:10:58    阅读次数:128
[实战4]DTS Report /main code/
@echooffrem-------------------------------------------------------------------------remAction:UserneedtocopySourcefiletoC:\temp\DTSrem-------------------------------------------------------------------------ifexist"C:\temp\DTS\*.htm"(goto0)else(goto1):0rem-..
分类:其他好文   时间:2015-04-21 14:48:44    阅读次数:157
linux fork()
一. linux下C语言可以用fork()建立子进程。fork函数返回两个值,对于子进程,返回0; 父进程,返回子进程ID. 所以用if(fork()==0) {子进程执行的代码段;}else {父进程执行的代码段;}二. fork()函数的作用:新建一个子进程。可以这么看,fork的意思就是分支,...
分类:系统相关   时间:2015-04-21 13:01:58    阅读次数:157
杭电2004(万一实现了呢)
#includeint main(){int t; while(scanf("%d",&t)!=EOF) {while(1) { if(t>100 || t=90) {printf("A\n"); break; } else if(t>=80) {printf("B\n"); br...
分类:其他好文   时间:2015-04-20 22:20:36    阅读次数:135
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!