csp

认证方法

认证考试全部采用上机编程方式,编程语言允许使用C/C++或Java。考核为黑盒测试,以通过测试用例判断程序是否能够输出正确结果来进行评分。考试时间为240分钟。

认证知识要求

考试内容主要覆盖大学计算机专业所学习的程序设计、数据结构以及算法,以及相关的数学基础知识。包括但不限于:

(1)程序设计基础

逻辑与数学运算,分支循环,过程调用(递归),字符串操作,文件操作等。

(2)数据结构

线性表(数组、队列、栈、链表)、树(堆、排序二叉树)、哈希表、集合与映射、图

(3)算法与算法设计策略

排序与查找,枚举,贪心策略,分治策略,递推与递归,动态规划,搜索,图论算法,计算几何,字符串算法、线段树、随机算法,近似算法等。

在成绩评测时,评测方会使用精心设计的输入数据来运行你的程序,并检查你程序输出的正确 性,这些数据通常和样例给出的数据是不一样的。如果用你的程序运行样例不能得到正确结果,一般是因为编制的程序存在错误,该题将不能得分,或不能得到满 分。如果样例得到了正确结果,也不代表该程序完全正确,你最好使用多组数据从多角度进行测试。

接下来去看下模拟题和历年真题60道

CCF认证历年真题 满分代码:https://blog.csdn.net/wl16wzl/article/details/79344292

。。。。。。

太久没看C++

一些常用的知识练手:STL库简单示例

#include<bits/stdc++.h>    //包含了所有头文件

#define inf ox3f3f3f          //可认为此数无限大

1.结构体

  简单例子

#include<bits/stdc++.h>
using namespace std;

struct node
{
    int x,y,z;
    node(int tx,int ty,int tz):x(tx),y(ty),z(tz){}
    node(){}
}a,b,c;
int main()
{
    a=node(1,2,3);
    cout<<a.y<<endl;

}

2.sort排序简单用法

#include<bits/stdc++.h>
using namespace std;

char a[105]={'c','b','e','d','a'};
int main()
{
    sort(a,a+5,greater<int>());
    for(int i=0;i<5;i++)
        cout<<a[i]<<" ";
}

去掉greater是从小到大排序

3.find和string::npos

#include<bits/stdc++.h>
using namespace std;

string a;
string b;
int main()
{
   a="aaaaaa";
   b="aa";
   if(a.find(b)!=string::npos)  //string::npos找到串尾没找到,相当于-1,但有时候写-1编译器不通过,所以写这个靠谱些
   {
       cout<<"yes"<<endl;
   }
   else
    cout<<"no"<<endl;
}

4.substr

 a="abcdef";
   string t=a.substr(0,5);//取字符串1-5个字符
   cout<<t<<endl;

5.begin,erase

6.insert

 a="abcdefg";
   a.insert(2,"kk");
   cout<<a<<endl;

7.size,length

a="abcdefg";
   cout<<a.size()<<endl; //a.length 推荐size

8.数组及一些基本用法

vector<int> g;
g.push_back(1);
g.size();
g.erase();
g.begin();

9.队栈

#include<bits/stdc++.h>
using namespace std;
stack<int> st;
queue<int> qu;
int main()
{
    st.push(1);
    st.push(2);
    st.push(4);
    st.push(3);
    cout<<st.size()<<endl;
    while(!st.empty())  //st.size()!=0
    {
        cout<<st.top()<<" ";
        st.pop();
    }
    cout<<endl;
    qu.push(1);
    qu.push(2);
    qu.push(4);
    qu.push(3);
    cout<<qu.size()<<endl;
    while(!qu.empty())
    {
        cout<<qu.front()<<" ";
        qu.pop();
    }

}

10.双端队列基本用法

#include<bits/stdc++.h>
using namespace std;
deque<int> de;
int main()
{
    de.push_back(2);
    de.push_front(1);
    for(int i=0;i<de.size();i++)
    {
        cout<<de[i]<<" ";
    }
    de.pop_back();
    de.pop_front();
    de.clear();
}

11.map,pair

#include<bits/stdc++.h>
using namespace std;
map<string,int> mp;
int main()
{
    pair<int,int>(1,3);
    mp["aaa"]=1;
    cout<<mp["aaa"]<<endl;
}

12.lower_bound ,upper_bound    二分查找对排序好的一组值操作

lower_bound(起始地址,终止地址,要查找的值)

https://blog.csdn.net/qq_40160605/article/details/80150252

13.cmp

#include<bits/stdc++.h>
using namespace std;
struct node
{
    int x,y,z;
}a[105];
bool cmp(node a,node b)
{
    return a.z<b.z;
}
int main()
{
   sort(a,a+100,cmp);
}

 

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值