码迷,mamicode.com
首页 >  
搜索关键字:cout    ( 7219个结果
标准库时间工具
//关于duration: #include <iostream> #include <chrono> using namespace std; using namespace std::chrono; void f(int x) { for(int i=0;i!=x;++i) cout << i ...
分类:其他好文   时间:2020-07-18 13:45:36    阅读次数:83
线段树那些事
线段树是学不明白了…… 部分指针用法 对于这段代码, struct Node{ int a, b, c; }YJH[100], x; Node *p = YJH, *q = &x; 以下代码在使用过程中是等价的: cout << x.a << endl; cout << q->a << endl; ...
分类:其他好文   时间:2020-07-18 00:55:56    阅读次数:106
C. Given Length and Sum of Digits... (贪心)
https://codeforces.com/problemset/problem/489/C C. Given Length and Sum of Digits... You have a positive integer m and a non-negative integer s. Your ...
分类:其他好文   时间:2020-07-17 22:18:10    阅读次数:71
C++ template
1 函数模板 #include <iostream> using namespace std; template <typename T> T square(T a) { return a * a; } int main(void) { cout << square<int>(3) << endl; ...
分类:编程语言   时间:2020-07-17 14:03:22    阅读次数:65
STL的accumulate用法
std::accumulate 该函数定义于头文件 ,它主要用于累加求和和自定义数据类型的处理。 template< class InputIt, class T > constexpr T accumulate( InputIt first, InputIt last, T init ); tem ...
分类:其他好文   时间:2020-07-16 00:07:47    阅读次数:69
POJ 1182
重新做了一下这道并查集的题目,关键要点是抓住这种循环的关系和模运算的通性,进而利用加权并查集 #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; cons ...
分类:其他好文   时间:2020-07-15 23:39:09    阅读次数:63
c++实现快排基础版本
#include <iostream> #include<algorithm> #include<vector> using namespace std; void swap(int& a, int& b) { int t = a; a = b; b = t; } void quicksort(ve ...
分类:编程语言   时间:2020-07-15 23:16:35    阅读次数:65
PAT乙级B1001
#include <iostream> #include<algorithm> using namespace std; int main() { int n; int k = 0; cin >> n; while (n != 1) { if (n % 2 == 0) { n /= 2; k++; ...
分类:其他好文   时间:2020-07-15 23:10:43    阅读次数:63
10.合并集合 并查集
并查集的作用 并查集是用树的形式维护所有集合 每一个集合用一个树来维护 每一个集合的编号是它根节点的编号 令每一个树根的p[x] = x 然后对于每一个点,都存储一下这个点的父节点是谁,p[x] = ? 然后当我们想求某个点属于哪个集合的时候 就找到这个点的father,然后看其是不是树根,不是的话 ...
分类:其他好文   时间:2020-07-14 13:23:44    阅读次数:48
模板方法模式(c++实现)
外观模式 模式定义 模板方法模式(Facade),定义一个操作中的算法的骨架,而将一些步骤延迟到子类中。模板方法使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤。 模式动机 当我们要完成在某一细节层次一致的一个过程或一系列步骤,但其个别步骤在更详细的层次上的实现可能不同时,我们通常考虑 ...
分类:编程语言   时间:2020-07-14 13:12:41    阅读次数:67
7219条   上一页 1 ... 23 24 25 26 27 ... 722 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!