5.1
Introduction
NOIP(National Olympiad in Informatics in Provinces):全国青少年信息学奥林匹克联赛
NOI(National Olympiad in Informatics):全国青少年信息学奥林匹克竞赛
CPU(Central Processing Unit):中央处理器
CPU - memory - O/I device
1 byte = 8 bit
前置知识
int a;
int *b = &a;
*:pointer 指针
&:address 地址
*(a + 1) = x 等价于 a[1] = x
int:%d
long long:%lld / %I64d
usigned int:%u
usigned long long:%llu
数据结构(struct)
对象(class)
%*d 读完扔掉
#include<cstdio>
scanf printf
#include<cstring>
memset strlen strcmp
#include<ctime>
time(0)
#include<cstdlib>
rand() srand()
#include<iostream>
cin cout string
cin 关闭同步 std::ios::sync_with_stdio(false)//速度提高至scanf左右
#include<algorithm>
sort lower_bound max min
#include<cmath>
sqrt sin log pow
int read(){
int x = 0,f = 1;
char ch = getchars();
while(ch < '0' || ch > '9'){
if(ch == '-')
f = -1;
ch = getchars();
}
while(ch >= '0' && ch <='9'){
x = x * 10 + ch - '0';
ch = getchars();
}
return x * f;
}
//////////////////////////////////////////////
fread
复杂度(Complexity)
Big-O Notation:大O记号
定义:T(n) = O(f(n)) iff(当且仅当)存在 c,N > 0 s.t.(subject to)任意 n > N T(n) <= c * f(n)
主定理(master theorem):用渐近符号表示许多由分治法得到的递推关系式
P(polynomial)问题:能在多项式时间内解决的问题
NP问题:(Nondeterministic Polynomial time Problem)不能在多项式时间内解决或不确定能不能在多项式时间内解决,但能在多项式时间内验证的问题
NPC问题:(NP Complete)NP完全问题,所有NP问题在多项式时间内都能规约(Reducibility)到它的NP问题,即解决了此NPC问题,所有NP问题也都能得到解决
NP hard问题:NP难问题,所有NP问题在多项式时间内都能规约到它的问题,但不一定是NP问题
some websites
to be continued ...