随笔分类 - csp认证
csp考试准备
摘要:/*注意事项 1.c语言中三角函数的用法sin(),asin(),cos(),acos() 2.注意分类讨论的情况,分两点之间的直线是在圆内还是圆外进行讨论 3.注意大数组直接打表,求得的部分结果存好 4. 请以“整数部分、小数点、小数部分”的格式输出实数,并保留不少于 12 位小数结果。采用其他格
阅读全文
摘要:注意将题抽象成一个图的形式,同时注意w[MAXN]的使用来记录通过每个器件时的结果 //每通过一个器件维护依次w[MAXN],用来跟新所有器件的状态,最后得到一个总状态,然后根据相应的要求输出即可。 #include <bits/stdc++.h> using namespace std; cons
阅读全文
摘要://注意不能使用两重循环 #include <bits/stdc++.h> using namespace std; const int maxn=2e5+5; struct node{ int x,y; }s[maxn]; struct node1{ int x,y,a,b,sum; }s1[ma
阅读全文
摘要:#include <iostream> #include <cstring> #include <queue> //1.读准题意,是问第一个到第二个之间的距离 //2.注意范围,稍微大大一点的数尽量用long long //3.采用广度搜索,可以实现找到最短路径 //4.该题的关键在于引入kcoun
阅读全文
摘要:#include <iostream> using namespace std; const int N=10; struct{ int winno; int x_1,y_1,x_2,y_2; } win[N]; struct{ int x,y; }point[N]; int order[N]; i
阅读全文
摘要://分别从初始位置和终点出法,找到起点可以到达而终点无法到达的点 #include <iostream> #include <algorithm> #include <string.h> #include <cmath> #include <stdio.h> #include <queue> #de
阅读全文
摘要:#include <bits/stdc++.h> // 所有的0都出现在所有的1之前,而所有的2都出现在所有的3之前。 //1.动态规划求解 //2.由题意可得最高位的数值是2 //3.以剩余为使用的元素作为基准开始进行动态规划的递推 //4.注意要在运算的过程中取余(在运算的过程中取余和得到最后的
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; //不是递增的话就删掉,然后重新计算一次 int getMaxArea(vector<int> &vec) { stack<int> s; int max_area = 0; int i=0; int tp,
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; int num[1005];//O(n2)的时间复杂度 int main(){ int n; cin>>n; for(int i=1;i<=n;++i){ cin>>num[i]; } int temp_mi
阅读全文
摘要:#include<bits/stdc++.h> //注意学会使用结构体和相应的排序,直接记录好相应的编号 //避免使用堆这种数据结构来减少时间复杂度,编起来太复杂 using namespace std; const int maxn =2005; int n,x,y; struct node{ i
阅读全文
摘要:在一个操场上摆放着一排 NN 堆石子。现要将石子有次序地合并成一堆。规定每次只能选相邻的 22 堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的得分。 试设计一个算法,计算出将 NN 堆石子合并成一堆的最小得分。 输入格式 第一行一个整数 NN。 接下来 NN 行,第 ii 行一个整数 a_i
阅读全文
摘要:1.若测试数据 n取到10^9数量级,则一般应该采用O(logn)或者O(根号n)的算法,一般O(n)的算法只能支持到10^8数量级 2.注意使用动态规划,并利用矩阵加速来加快运行时间。
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; const int N=1000; pair<int,int> p[N]; int cnt[5]; int main(){ ios::sync_with_stdio(false),cin.tie(0),cout
阅读全文
摘要:#include <iostream> #include <vector> using namespace std; struct Markdown{ int type;//标记相应的类型 0 空行,1 项目列表第一行 2项目列表其余行 3段落 string s; }; bool isSpace(s
阅读全文
摘要:1.对于大部分OJ,没有必要全部读取完,存完,然后再计算。可以直接在读取的时候直接进行计算,这样可以简省运算空间。 2.使用 ios::sync_with_stdio(false);加速数据的读取,测试时该速度比scanf和printf要快。 3.注意: C++中,cin和cout要与stdio同步
阅读全文

浙公网安备 33010602011771号