- 博客(32)
- 资源 (4)
- 收藏
- 关注
原创 线性表(链表)
#include<stdio.h>#include<stdlib.h>typedef struct LNode { int data; struct LNode *next;}LNode,*LinkList;void CreatList_L(LinkList &L, int n) { //逆位序输入n个元素的值,建立带表头结点的单链线性表L. L ...
2018-09-28 23:56:18 265
原创 线性表(顺序表)
#include<cstdio>#include<cstdlib>#include<iostream>#include<algorithm>using namespace std;//定义顺序表初始容量和扩容容量#define LIST_INIT_SIZE 100#define LISTINCREMENT 10typedef str...
2018-09-28 23:53:00 178
原创 海伦公式:
l为半周长,s为面积float l = (a + b + c) / 2;float s = sqrt(l*(l - a)*(l - b)*(l - c));
2018-09-28 23:51:29 4309
原创 你会自己实现sizeof这个库函数吗?
#define what(v) (char*)(&v+1)-(char*)(&v)7个字符的串,却输出8,因为有'\0'啦哈哈C++学习交流群:群号:810196747
2018-09-28 23:39:40 589
原创 ACM/ICPC 2018亚洲区预选赛北京赛站网络赛题目4 : 80 Days
#include <map>#include <cstring>#include <string>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cctype&
2018-09-22 18:11:35 600
原创 POJ-2503 B - Babelfish
题意:你去了一个新城市,需要听懂别人说话,给你一本字典,通过这本字典,你可以把他们的方言词翻译成你掌握的词汇,如:dog对应方言是ogday,输入字典上收录的词条,如下:dog ogdaycat atcaypig igpayfroot ootfrayloops oopslay注意:字典与查询之间输入换行接下来是根据字典查询方言对应的你掌握的词汇,如果有,打印出对应词汇,如果没...
2018-09-21 14:43:26 281
原创 python字符串的方法及注释:
函数 功能 capitalize() 把字符串的第一个字符改为大写 casfold() 把整个字符串的所有字符改为小写 center(width) 将字符串居中,并使用空格填充长度至长度width的新字符串 co...
2018-09-20 19:20:37 298
原创 abc:def:ghi=1:2:3问题
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){ int n, i, j; char a[10];//数组定义比实际大一些 for(n = 123; n < 330; n++) { ...
2018-09-20 19:18:48 556
原创 冒泡排序(从小到大)
void bubble(int work[],size_t size,int(*compare)(int a,int b)){ void swap(int *element1Ptr,int *element2Ptr); for(unsigned int pass=1;pass<size;++pass){ for(size_t count=0;count&l...
2018-09-20 19:15:49 1475
原创 vim 编辑- - >输入:
i: 在当前光标所在字符的前面,转为输入模式;a: 在当前光标所在字符的后面,转为输入模式;o: 在当前光标所在行的下方,新建一行,并转为输入模式;I:在当前光标所在行的行首,转换为输入模式A:在当前光标所在行的行尾,转换为输入模式O:在当前光标所在行的上方,新建一行,并转为输入模式;...
2018-09-20 19:11:53 147
原创 C预处理
指示 描述 #define 替代预处理宏 #include 从另一个文件中插入一个特定的头 #undef 取消定义预处理宏 #ifdef 如果定义了这个宏返回true #ifndef...
2018-09-20 19:07:49 108
原创 中国传媒大学GPA算法
单门课程GPA=4-3*(100-X)**2/1600(60≤X≤100),X为课程分数;例如:60 1 61 1.15 62 1.29 63 1.43 64 1.57 65 1.7 66 1.83 67 1.96 68 2.08 69 2.2 70 2.31 71 2.42 72 2.53 73 2.63 74 2.73 75 2.83 76 2.92 77 3.01 78 ...
2018-09-20 19:04:40 2971 1
原创 穿越空间的限制,走最短的路找到你
1.最短路u->v之间的最短路满足以下限制: 对任意k ∈ G(V,E) 有 dist u,v <= dis u,k + dis k,j关键操作-松弛:void relax(int i,int j,int k){ if(dis[k]>dis[i]+j) dis[k]=dis[i]+j;} 2.多源点多汇点最短路FLOYD复杂度 O(...
2018-09-20 18:58:49 169
原创 ST算法求最值:
const int maxn=50005;int a[maxn],dp[maxn][30],d[maxn][30];void rmq(){ for(int i=1;i<=n;i++){dp[i][0]=a[i];d[i][0]=a[i];} for(int j=1;(1<<j)<=n;j++){ for(int i=1;i+(1<...
2018-09-19 19:43:40 162
原创 线段树求最值:
#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;#define maxn 50005#define inf 0x3f3f3f3fint n,q;int a[maxn],ll[maxn<<1]...
2018-09-18 22:44:11 532 6
原创 unique函数:
#include <iostream>#include <cassert>#include <algorithm>#include <vector>#include <string>#include <iterator> using namespace std; int main(){ //cout...
2018-09-18 22:43:37 554
原创 字符串在不在字符串数组里:字符串哈希
# include <iostream># include <stdio.h># include <string.h># include <algorithm># include <math.h># include <queue># include <string># include <
2018-09-18 22:43:00 218
原创 马拉车:
char数组型:int const MAX = 110005;char s[MAX << 1];int p[MAX << 1];int Manacher(){ int len = (int)strlen(s), maxp = 0, ans = 0; for(int i = len; i >= 0; i--) { ...
2018-09-18 22:40:38 155
原创 网络流:
Ek算法:#include<cstdio>#include<cstring>#include<algorithm>#include<string>#include<iostream>#include<queue>using namespace std;int pre[250];int n,m;int ed...
2018-09-18 22:39:18 73
原创 欧拉函数打表:
#define maxn 3000010int p[maxn];void oula(){ int i,j; for(i=1; i<=maxn; i++) p[i]=i; for(i=2; i<=maxn; i+=2) p[i]/=2; for(i=3; i<=maxn; i+=2) if(p[i]==i...
2018-09-18 22:38:10 160
原创 eps double 的==与!= :
int sgn(double a){return a < -eps ? -1 : a < eps ? 0 : 1;}const double eps=1e-8; 传统意义 修正写法1 修正写法2 a == b sgn(a - b) == 0 fabs(a – b) ...
2018-09-18 22:37:26 276
原创 费马小定理:
若p是质数,且a和p互质,则(a^(p-1))%p=1。例如:3和5互质,那么(3^(5-1))%5=(3^4)%5=81%5=1。应用:求逆元,时间复杂度O(log(n))。因为(a^(p-1))%p=(axa^(p-2))%p=((a%p)x(a^(p-2))%p)%p=1,由此得到:inv(a)=(a^(p-2))%p。计算过程需要快速幂优化。...
2018-09-18 22:35:57 785
原创 I - Andy's First Dictionary UVA - 10815
Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instead of thinking up all the wo...
2018-09-18 22:32:18 88
转载 J - Ananagrams
Most crossword puzzle fans are used to anagrams — groups of words with the same letters in different orders — for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have this attribute...
2018-09-18 22:29:14 133
原创 解决Mac 的Operation not permitted
如何关闭(SIP)重启按住 Command+R,进入恢复模式,打开Terminalcsrutil disable 如何开启重启按住 Command+R,进入恢复模式,打开Terminal。csrutil enable
2018-09-16 21:23:25 3628
原创 解决win10分辨率过高导致某些软件显示小的办法:
右键->属性->兼容性->更改所有用户的设置->更改高DPI设置->高DPI缩放替代->勾选替代高DPI的缩放行为指定系统(在应用程序,系统,系统增强里选系统)C++学习交流群:群号:810196747...
2018-09-16 21:20:48 60800 32
原创 汇编语言的浪漫
四颗颜色不同的小心心,是不是很可耐。想知道它是怎么实现的吗?那就继续往下看:要想用机器语言或是汇编语言在电脑上成像,我们首先要能把指令写入计算机显存:通过上图,可以看出计算机内存中的显存地址空间是从oxA0000到0xBFFFF,也就是说,只要我们只要把指令写进这段内存里,就可以通过显示器看到指令所成像。在段地址为oxb810,偏移地址为0000的内存空间中写入这样一段指令...
2018-09-15 11:20:17 1500 2
时钟程序(Windows桌面应用程序)源码
2018-12-19
gyiClock03
2018-11-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人