码迷,mamicode.com
首页 >  
搜索关键字:do ... while 循环    ( 74622个结果
【LeetCode】Rotate Image
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思路:先将矩阵转置,然后将第一列与最后...
分类:其他好文   时间:2014-05-14 03:09:35    阅读次数:225
c++ template怎么使用及注意事项
c++ 中的template和c#的什么有点相似?先看下定义方式:template T myFunction(T param1,T param2...){ T result= param1; // do something return result; ...
分类:编程语言   时间:2014-05-14 03:05:27    阅读次数:332
C语言文件操作(一)
实例1:读写字符文件,每次读取一个字符。#include<stdio.h>#include<stdlib.h>intmain(){FILE*fpin;FILE*fpout;charc;fpout=fopen("c:\\dest.txt","wt");if((fpin=fopen("c:\\test.txt","rt"))!=NULL){c=fgetc(fpin);while(c!=EOF){fputc(c,fpout);c=fgetc(fpin);..
分类:编程语言   时间:2014-05-12 03:57:13    阅读次数:238
C语言文件操作(二)
实例2:读取字符文件,每次读入一个缓存里面。#include<stdio.h>#include<stdlib.h>#defineMAXLEN1024intmain(){FILE*fin;FILE*fout=fopen("c:\\dest.txt","wt");charbuf[MAXLEN];if((fin=fopen("c:\\test.txt","rt"))!=NULL){char*c=fgets(buf,MAXLEN,fin);while(..
分类:编程语言   时间:2014-05-12 02:57:48    阅读次数:251
python中的静态方法和类方法
静态方法独立于类和类的实例,它是定义在类作用域内的方法。可以由类和实例直接调用。 类方法和静态方法都要使用装饰器来定义,定义的基本格式是: @staticmethod def ():          #do something 类方法定义的基本格式是: @ classmethod def (cls):          #dosomething 类方法与成员方法不同的是,它需...
分类:编程语言   时间:2014-05-11 22:25:53    阅读次数:422
ZOJ 1151 Word Reversal反转单词 (string字符串处理)
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=151 For each list of words, output a line with each word reversed without changing the order of the words. This problem contains multi...
分类:其他好文   时间:2014-05-11 22:20:43    阅读次数:443
【The beauty of math】无限循环小数转分数
0.333333... = 1/3 推导过程: 设x=0.333333 10x=3.333333(循环体的数字个数为1) 10x-x=3 x=1/3 所以计算的核心在于确定无限循环的循环体的数字个数。...
分类:其他好文   时间:2014-05-11 22:18:39    阅读次数:285
ZOJ 2109 FatMouse' Trade (背包 dp + 贪心)
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1109 FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean...
分类:其他好文   时间:2014-05-11 20:57:36    阅读次数:400
ZOJ 2724 Windows 消息队列 (优先队列)
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2724 Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something h...
分类:Windows程序   时间:2014-05-11 20:31:56    阅读次数:796
UVa 673 括号平衡
思路:简单的匹配操作,利用栈。 Code: #include #include char stack[135]; int main() { int n; scanf("%d",&n); getchar(); while(n-->0) { memset(stack,0,sizeof(stack)); char c; int top=0; int flag=1;...
分类:其他好文   时间:2014-05-11 20:19:34    阅读次数:376
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!