随笔分类 - C++
C语言字符串函数例子程序大全 – string相关
摘要:关于字符串函数的应用细则,例子程序 – jerny函数名: stpcpy 功 能: 拷贝一个字符串到另一个 用 法: char *stpcpy(char *destin, char *source); 程序例: #include #include int main(void) { ch...
阅读全文
C/C++头文件一览
摘要:C、传统 C++ #include //设定插入点 #include //字符处理 #include //定义错误码 #include //浮点数处理 #include //文件输入/输出 #include //参数化输入/输出 #include //数据流输入/输出 #include...
阅读全文
字符数组与字符串的转换
摘要:1:字符数组换为字符串见代码[cpp]view plaincopyprint?#include#includeusingnamespacestd;intmain(){chara[10]="aaaabbbba";strings(&a[0],&a[strlen(a)]);cout#includeusin...
阅读全文
对于C++窗口编译一闪而过的解决方法 (DEV CPP下)
摘要:对于C++窗口编译一闪而过的解决方法首先来看一个简单的程序(编译环境为DEVC++。):#includeintmain(){std::cout#include"stdlib.h"intmain(){std::cout::max(),'\n');
阅读全文
C语言中取绝对值函数的区分
摘要:头文件为 #includeint 型int abs(int x);long 型long labs(int x);浮点数 float doubledouble fabs(double x);
阅读全文
#include <queue> 的使用
摘要:#include #include using namespace std; //这几个头文件必不可少int main(){queue q; //使用前需定义一个queue变量,且定义时已经初始化while(!q.empty()) q.pop(); //重复使用时,用这个初始化q.push(1); ...
阅读全文
动态规划之MAX Sum
摘要:Max Sum Time Limit : 2000/1000ms (Java/Other) Memory Limit :65536/32768K (Java/Other)Total Submission(s) : 6 Accepted Submission(s) : 0Font:Times New ...
阅读全文
Moving Tables
摘要:Moving TablesTime Limit : 2000/1000ms(Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 1AcceptedSubmission(s) : 1Font:Times Ne...
阅读全文
FatMouse' Trade
摘要:FatMouse' TradeTime Limit : 2000/1000ms(Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 6AcceptedSubmission(s) : 4Font:Times ...
阅读全文
贪心算法之装船问题
摘要:问题描述:吉祥号货轮最大载重量为M吨,有N件货物供选择装船,每件货物的重量和价值是不同的。设计程序使得总重量不超过M,且装的货物总价值最大。//*************************//* 任务介绍:贪心算法之 *// 装船问题 *//* 作者: 何香 ...
阅读全文
一只小蜜蜂
摘要:一只小蜜蜂...Problem Description有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。其中,蜂房的结构如下所示。Input输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0using ...
阅读全文
计算牛的数目
摘要:母牛的故事Problem Description有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0using namespace std;int...
阅读全文
计算a^3=b^3+c^3+d^3
摘要:Perfect CubesProblem DescriptionFor hundredsof years Fermat's Last Theorem, which stated simply that forn > 2there exist no integers a, b, c > 1 sucht...
阅读全文
用递归计算C(m,n)
摘要://****************************//程序名:C(m,n).cpp *//作者:何香 *//编制时间:2013年9月25日 *//主要功能:计算C(m,n) *//C(m,n)=C(m-1,n)+C(m-...
阅读全文
A Mathematical Curiosity
摘要:Problem DescriptionGiven twointegers n and m, count the number of pairs of integers (a,b) such that 0 using namespace std;int main(){ int a,b,m,n,N,co...
阅读全文