C/C++
御坂10358
"Place upon the object held but one great wish."
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
struct_and_sort_and_structSort
cpp/Algorithm/sort 和 利用sort对结构体排序 先说sortcppreference里sort的几种用法:1.// sort using a standard library compare function objectstd::sort(s.begin(), s.end(), std::greater<int>());for (auto a : s) { s原创 2017-04-06 22:50:41 · 276 阅读 · 1 评论 -
等差素数数列
蓝桥杯 04/08/2017标题:等差素数列2,3,5,7,11,13……是素数序列。 类似:7,37,67,97,127,157 这样完全由素数组成的等差数列,叫等差素数数列。 上边的数列公差为30,长度为6。2004年,格林与华人陶哲轩合作证明了:存在任意长度的素数等差数列。 这是数论领域一项惊人的成果!有这一理论为基础,请你借助手中的计算机,满怀信心地搜索:长度为10的等差素数列,其公原创 2017-04-08 15:05:04 · 2630 阅读 · 0 评论 -
图的存储结构---(*链式前向星*)
(写出来仅供随时参考)邻接矩阵 代码引自my_Dijkstratypedef struct ArcCell { int weight; // 邻接矩阵的元素即为图的边的权值}ArcCell, AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM];typedef struct { int vexs[MAX_VERTEX_NUM]; // 存放顶点的数组原创 2017-04-10 23:56:09 · 497 阅读 · 0 评论 -
memset
std::memset Defined in header <cstring> (‘<”>’的转义为<and>) Cppreference void* memset( void* dest, int ch, std::size_t count); Converts the value ch to unsigned char and copies it i原创 2017-04-11 21:09:50 · 438 阅读 · 0 评论 -
C/C++中的结构体
在C中:typedef struct Student{ int a;}Stu; struct Student stu1; Stu stu2; stu1.a = 2; stu2.a = 3;使用typedef后,Stu和struct Student一样,是一种结构体类型,能用来定义变量。在C++中:typedef struct Student{ int原创 2017-12-10 23:48:23 · 197 阅读 · 0 评论 -
C++的格式化输出之小数尾数
本文仅是个人想记录一下C++的某些用法,倘若以后忘了还能复习一下浮点数的显示精度 浮点数精度的含义取决于输出模式。在默认模式下,它指的是显示的总位数。在定点模式和科学模式下,精度指的是小数点后面的位数。C++的默认精度为6位。float a = 130, b = 3.1456;cout << a <&l...原创 2018-03-17 14:50:34 · 1411 阅读 · 1 评论 -
C-插入排序、归并排序、快速排序(代码记录)
目的:备忘 以下直接贴代码:#include<stdio.h>#include<stdlib.h>void myswap(int * a, int * b) { int tmp; tmp = *a; *a = *b; *b = tmp;}void insertion_sort(int * Ar, const int low, const int high) {原创 2018-04-14 00:39:04 · 214 阅读 · 0 评论 -
C-Fibonacci123
Fibonacci的三种写法,当N稍大一点时,递归的慢就显出来了。 参数N表示求的是第N项斐波那契数(这里设前两项是0、1) code:#include<stdio.h>long long Fibonacci1(long long n) { long long a = 0, b = 1, c, i; if(n == 1) return a...原创 2018-04-14 10:28:32 · 225 阅读 · 0 评论 -
[MPICH] Matrix Multiplication
Samples :10 55 31 2 3 4 56 7 8 9 1011 12 13 14 1516 17 18 19 2021 22 23 24 2526 27 28 29 3031 32 33 34 3536 37 38 39 4041 42 43 44 4546 47 48 49 501 5 1.12 4 2.23 3 3.34 2 4.45 1 5...原创 2018-06-09 22:46:09 · 274 阅读 · 0 评论
分享