码迷,mamicode.com
首页 >  
搜索关键字:for while until    ( 29426个结果
暑训day1解题报告
A -Painting the sticks因为不能覆盖涂/涂两次,所以就数数有几个三个一块儿就行了。#includeint a[100],ans ;int main(){ int n , t = 0 ; while (scanf("%d",&n)!=EOF) { for (...
分类:其他好文   时间:2014-07-16 20:37:36    阅读次数:317
hdu 2016 数据的交换输出
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2016题目大意:把最小的和第一个交换并输出。注意格式哦! 1 #include 2 int main () 3 { 4 int n,a[110],i,j,t,min; 5 while (...
分类:其他好文   时间:2014-07-14 09:22:53    阅读次数:304
hdu 2014 青年歌手大奖赛_评委会打分
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2014题目大意:去掉一个最高分和一个最低分求平均数。 1 #include 2 int main() 3 { 4 double n,a,i,s,max,min; 5 while(scanf...
分类:其他好文   时间:2014-07-13 11:01:58    阅读次数:202
在一个升序的但是经过循环移动的数组中查找指定元素
数组是升序的,数组经过循环移动之后,肯定是有左半部分或者有半部分还是升序的。 代码: public class SearchRotateArray { public static int search(int a[], int l, int u, int x) { while(l<=u){ int m = (l+u)/2; if(x==a[m]){ return m;...
分类:移动开发   时间:2014-07-12 23:11:02    阅读次数:271
网络流初步: 最大流
好吧。。 直接上模板。。。 queue q; memset(flow,0,sizeof(flow)); int f = 0; while(true){ memset(a,0,sizeof(a)); a[s] = INF; q.push(s); while(!q.empty)){ //BFS找增广路...
分类:其他好文   时间:2014-07-12 20:03:00    阅读次数:244
C和指针 (pointers on C)——第四章:语句(上)
第四章——语句(上) 总结总结!!! C没有布尔类型,所以在一些逻辑判断时候必须用整型表达式,零值为假,非零值为真。 for比while把控制循环的表达式收集起来放在一个地方,以便寻找。 do语句比while语句类似,但是前者能够保证循环体至少执行一次。 不要用goto。 switch...case...在没有加break时候多半有问题,我有一篇文章曾专门说这个事儿。 详情见http...
分类:其他好文   时间:2014-07-12 18:30:43    阅读次数:135
ACdream ACfun
题目不难,但由于个人英语不好。。。。。 百度了下,题目意思是要求出字典序最小的并且不是所输入字符的子串; 也就是输出最多的连续的A; 如果没有A,输出一个A; #include #include int main() { int a,i,j,b,c,d; char t[105]; scanf("%d",&a); while(a--) { d=1; scanf("%s",t...
分类:其他好文   时间:2014-07-12 17:14:32    阅读次数:152
Map.Entry<K,V>分析
一。好处你是否已经对每次从Map中取得关键字然后再取得相应的值感觉厌倦?1 Set keys = map.keySet( );2 if(keys != null) {3 Iterator iterator = keys.iterator( );4 while(iterator.hasN...
分类:其他好文   时间:2014-07-12 15:12:26    阅读次数:187
hdu4570
1 #include 2 #define N 65 3 using namespace std; 4 5 const long long INF = 1LL>_;12 while(_--)13 {14 int n,i,j,k;15 cin>>n;...
分类:其他好文   时间:2014-07-12 15:03:45    阅读次数:198
hdu 1059 Dividing 多重背包
就是看能不能装满给定容量的背包。#include #include int dp[200000],a[15];int main(){ int cas=0,c; int i,j,k; while(1) { int sum=0; cas++; ...
分类:其他好文   时间:2014-07-12 14:35:59    阅读次数:188
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!