![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++基础算法学习
wikioi_bai
时间并不会因为你的迷茫和迟疑而停留,就在你看这篇文章的同时,不知道有多少人在冥思苦想,在为算法废寝忘食,不知道有多少人在狂热地拍着代码,不知道又有多少提交一遍又一遍地刷新着OJ的status页面……
没有谁生来就是神牛,而千里之行,始于足下!
展开
-
局部变量的使用
局部变量就是说在一个函数内部原创 2014-11-08 23:08:27 · 1120 阅读 · 0 评论 -
C++写全排列 next_permutation
直接使用C++中的next_permutation来搞定全排列问题了~# include# include# includeusing namespace std;int a[20];int main(void){ int n; while ( cin>>n ) { for ( int i = 1;i <= n;i++ )原创 2015-02-05 22:36:27 · 509 阅读 · 0 评论 -
认认真真学习STL之string
# include# include# includeusing namespace std;int main(void){ string s1("Hello"); string s2(8,'x'); string month = "March"; string ob; cin>>ob;//string 支持流读取运算符 strin原创 2014-11-30 15:36:26 · 612 阅读 · 0 评论 -
二维数组__普通矩阵转换为稀疏矩阵
# include# include# includeconst int n = 3;const int m = 5;using namespace std;# define xh1 int i = 1;i <= n;i++# define xh2 int j = 1;j <= m;j++int main(void){ int a[n+1][m+1];原创 2014-11-06 17:07:51 · 1773 阅读 · 0 评论 -
字符串__常用字符串函数
/* 1.strcpy() 字符串的复制函数 2.strcat() 字符串的连接函数 3.strlen() 字符串求长度的函数 4.strcmp() 字符串比较函数,返回结果只有1和-1 5.strlwr() 字符串大写转换成小写 6.strupr() 字符串小写转换成大写*/# include# include# includeusi原创 2014-11-06 17:10:07 · 533 阅读 · 0 评论 -
字符串___回文串的判断
# include# includeusing namespace std;int main(void){ char letter[101]; char ch; cin>>ch; int i = 0; int j = 1; while ( ch!='.' ) {//输入字符串的一个很好的方法,需要学习原创 2014-11-06 17:06:47 · 526 阅读 · 0 评论 -
引用__简单的值交换
# include# includeusing namespace std;void swap( int &a,int &b );int main(void){ int x = 8; int y = 10; cout<<"x="<<x<<" y="<<y<<endl; swap( x,y ); cout<<"x="<<x<<" y="原创 2014-11-06 17:09:13 · 506 阅读 · 0 评论 -
C++中的简单实用sort进行,判重后排序
# include# include# includeusing namespace std;# define MAX 100int a[MAX];int main(void){ int n; while ( cin>>n ) { for ( int i = 0;i < n;i++ ) { cin>原创 2014-11-14 22:09:45 · 868 阅读 · 0 评论 -
lower_bound() 的使用
/* 1.有关对于 lower_bound()的基本使用方法和在使用中 经常用到的几点说明. 2.第一次学习lower_bound(),首先要对于lower_bound()中的 参数有一个初步的学习和认识,首先,我们知道 对于一个lower_bound(begin,last,val) eg. int pos = l原创 2014-11-13 18:16:57 · 658 阅读 · 0 评论 -
C++学习之宏
# include# includeusing namespace std;# define OK 123# define PI 3.1415926# define S PI*y*y //完成了宏的嵌套,也就是说在展开S这个宏的时候,PI已经被代换了int main(void){ int y;cin>>y; cout<<S<<endl; cout<<"原创 2014-11-11 20:16:42 · 467 阅读 · 0 评论 -
C++学习之函数重载
/* 在函数名相同,参数不同的情况下,系统能自动分辨出在调用时该使用 哪种函数,从而输出正确的答案.*/# include# includeusing namespace std;int add( int x,int y ){ return x+y;}double add( double a,double b ){ return a+b;原创 2014-11-11 20:14:53 · 556 阅读 · 0 评论 -
全局变量的使用
什么是全局变量呢?我们知道,全局变量是这样的变量,他们能原创 2014-11-08 23:13:09 · 620 阅读 · 0 评论 -
BNU寒假弱校联盟C.Shorter Musical Notes(upper_bound的使用)
C. Shorter Musical NotesTime Limit: 1000msMemory Limit: 65536KB64-bit integer IO format: %lld Java class name: MainSubmit Status PID: 4134 FJ is going to teach his cow原创 2015-02-16 23:09:31 · 706 阅读 · 0 评论