合集-csp真题满分解答
ccfcsp 201803.2 碰撞的小球 100分代码
摘要:本题是一道小模拟 规模小 难度在碰撞检测 在写模拟题时的思路应该是先找到应该储存的信息是哪些,抽象出来,应该模拟的方法是哪些。类似oop。 include using namespace std; const int L = 1000; struct ball{ int p; char d=1; /
阅读全文
ccfcsp 201703-2 学生排队 c++ stl 链表实现
摘要:这道题的话,首先上来读题,发现它是不能采用对每个序号采用累加的方式来判断移动多少的,因为不同序号的移动之间是会相互影响的,就像题例中的三号和八号相互影响了一样,导致三号虽然正二负二,但是并不在原来的位置上。 本题采用的是stl库中的list这个双向链表的数据结构,该数据结构的插入和删除效率高,主要是
阅读全文
csp 201912-1 试题名称: 报数
摘要:include <bits/stdc++.h> using namespace std; int main () { int n,a[4]={0},i; cin>>n; set st; for(i=1;i<2000;i++){ string z=to_string(i); if(z.find('7'
阅读全文
202009-1 称检测点查询 csp c++组
摘要:a数组记录距离平方值,其最大为2000的平方,不超int。 b数组记录3个距离最小的坐标。 ans记录下标。 每次选出一个坐标后其距离置为最大值。 include <bits/stdc++.h> typedef long long ll; using namespace std; int main
阅读全文
202112-1 序列查询 c++ csp
摘要:include <bits/stdc++.h> typedef long long ll; using namespace std; int main () { int n,N,a[210],i,sum=0; cin>>n>>N; a[0]=0; for(i=1;i<=n;i++){ cin>>a[
阅读全文
201612-1 试题名称: 中间数 csp ccf
摘要:数组元素范围小,利用桶排序,遍历桶数组判断是否存在中间数。 include <bits/stdc++.h> using namespace std; int main () { int n,i,sum=0; cin>>n; int a,b[1010]={0}; for(i=0;i<n;i++) {
阅读全文
201403-2 窗口 ccfcsp
摘要:小模拟 规模确实小 直接模拟不用搞优化 结构体起手模拟窗口 记录编号和优先级 每次点击更新优先级 include <bits/stdc++.h> using namespace std; struct l{ int x1,y1; int x2,y2; int seq; int pri; }; l l
阅读全文
202203-2 出行计划 ccf
摘要:一道比较明显的差分 利用查询递增性质 减少时间复杂度到o{n} include <bits/stdc++.h> using namespace std; const int N=2e5+10; int main() { int dif[N]={0}; int n,m,k,x,j,i,sum = 0,
阅读全文
202009-2 风险人群筛查ccfcsp
摘要:小细节多 读题要认真 注意是连续的段 思路较简单 include using namespace std; int main() { int n,k,t; int i,j; scanf("%d%d%d",&n,&k,&t); int x1,y1,x2,y2; int x3,y3; int cnt2=
阅读全文
2024-06-02 矩阵重塑2
摘要:include <bits/stdc++.h> using namespace std; const int maxn=1e4+1; int mar[maxn]; void tmar(int mar[],const int n,const int m){ int mat[n+1][m+1],mat1
阅读全文
202312-2 因子化简ccfcsp
摘要:常规质数因子 带相关资料抄写 稍加修改指数的筛选部分 include include<math.h> typedef long long ll; using namespace std; bool isprime(ll n){ int i; if(n<=1) return false; int sq
阅读全文
201412-2 Z字形扫描 ccf
摘要:先找到斜线的起始点 然后输出斜线上各点 include <bits\stdc++.h> typedef long long ll; using namespace std; int main() { int n,i,j,sum,cnt,x,y; cin>>n; int a[501][501]; in
阅读全文
201909-2 小明种苹果(续)ccfcsp
摘要:一道简单的模拟 。。。 include include using namespace std; int main() { const int N=1010; bool drop[N]={false}; int n,m,i,j,cnt=0,cnt1=0; cin>>n; int y; int sum
阅读全文
浙公网安备 33010602011771号