![](https://img-blog.csdnimg.cn/20200803231015453.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
CSP
基于c和c++的CSP练习
lzh~
Keep on going never give up.
展开
-
202012-2 期末预测之最佳阈值
样例1输入60 01 01 13 15 17 1样例1输出3样例2输入85 15 05 02 13 04 0100000000 11 0样例2输出100000000满分代码用map<int,vector<int>>进行自动排序,去重,和vector的不定长存储分开两次计算一次计算小于自己的复合条件的一次计算大于等于自己的符合条件的#include<bits/stdc++.h>using names原创 2021-04-07 21:15:29 · 158 阅读 · 0 评论 -
202012-1期末预测之安全指数
代码#include<bits/stdc++.h>using namespace std;int main(){ int n,sum=0; cin >> n; for(int i=0; i<n; i++) { int a,b; cin >> a >> b; sum += (a*b); } cout << max(0,sum); return 0;}样例输入162 6010 1000 7原创 2021-04-05 19:18:22 · 91 阅读 · 0 评论 -
CSP-201312-1-出现次数最多的数
URL映射(传送门)一道水题,没什么要讲的,直接上满分代码#include <bits/stdc++.h>using namespace std;int n;int a[1001];int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } sort...原创 2020-03-06 21:21:28 · 251 阅读 · 1 评论 -
CSP-201312-2-ISBN号码
URL映射(传送门)一道水题,没什么要讲的,直接上满分代码#include <bits/stdc++.h>using namespace std;string s;char a[10];int main(){ cin >> s; int i = 0; int j = 0; while(s[i]){ if(s[i] != '-'){ a[...原创 2020-03-06 21:26:38 · 172 阅读 · 0 评论 -
CSP-201312-3-最大的矩形
最大的矩形(传送门)相比于近几年的题,这个题太幸福了,没什么难度O(∩_∩)O哈哈~满分代码#include <bits/stdc++.h>using namespace std;int n;int main(){ vector<int> a; cin >> n; for (int i=0;i < n; i++){ int x...原创 2020-03-06 21:37:17 · 185 阅读 · 0 评论 -
CSP-201403-1-相反数
相反数(传送门)一道水题,没什么难度满分代码#include <bits/stdc++.h>using namespace std;int n;int a[501];int b[501];int main(){ cin >> n; int data; int j=0; int k=0; for(int i = 0; i < ...原创 2020-03-06 21:43:51 · 235 阅读 · 0 评论 -
CSP-201403-2-窗口
窗口(传送门)一道水题,没什么难度,结构体解决的问题满分代码#include <bits/stdc++.h>using namespace std;int n;int m;struct node{ int is; int ie; int js; int je; int no; int r;}a[11];int b[11];int main(){...原创 2020-03-06 21:57:48 · 1132 阅读 · 0 评论 -
CSP-201403-3-命令行选项
命令行选项(传送门)相比于这几年的第三题,之前的第三题太友好了写这道题的时候主要用到了map进行数据存储,queue进行存储和输出结果,以及istringstream进行字符串的分割满分代码#include <bits/stdc++.h>using namespace std;int p[30] = {0};//记录选项,0表示不存在,1表示无参数,2表示...原创 2020-03-06 22:08:39 · 238 阅读 · 0 评论 -
CSP-201409-1-相邻数对
相邻数对(传送门)一道水题,没什么可说的满分代码#include <bits/stdc++.h>using namespace std;int n;int a[1001];int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } sort(a,a...原创 2020-03-06 22:17:22 · 189 阅读 · 0 评论 -
CSP-201409-2-画图
画图(传送门)一道水题,没什么可说的,只需要将一个正方形用它的一个点代替就行(本博主用的左下角的点代替),再用一个标记判断是否算过即可满分代码#include <bits/stdc++.h>using namespace std;int n;int a[101][101];int main(){ cin >> n; int is,js,ie,je...原创 2020-03-06 22:25:27 · 217 阅读 · 0 评论 -
CSP-201409-3-字符串匹配
字符串匹配(传送门)怎么说呢,要是今年的csp第三题又这么简单就好了,直接用string字符串就解决了满分代码#include <bits/stdc++.h>using namespace std;int n;string str[101];int main(){ string s1; int z; cin >> s1 >> z >...原创 2020-03-06 22:33:50 · 335 阅读 · 0 评论 -
CSP-201412-1-门禁系统
门禁系统(传送门)一道水题,没什么说的满分代码#include <bits/stdc++.h>using namespace std;int n;struct node{ int data; int no;}a[1001];int main(){ cin >> n; for(int i = 0; i < n; i++){ cin ...原创 2020-03-06 22:46:39 · 251 阅读 · 0 评论 -
CSP-201412-2-Z字形扫描(已改进)
Z字形扫描(传送门)这道题还是有点意思的,当时写了半天,有几个失误点,写在代码中了,不像之前的一些水题满分代码#include <bits/stdc++.h>using namespace std;int n;int a[500][500];int main(){ cin >> n; for(int i = 0; i < n; i++){...原创 2020-03-06 22:54:13 · 258 阅读 · 0 评论 -
CSP-201412-3-集合竞价
集合竞价(传送门)这道题目,就是低价买,高价卖,用一个结构体来代表三类人,其中用一个type来代表是卖家还是买家,sell从小到大,buy从大到小排序,进行选择合适的进行(之前写的,一些点也记不起来了,只记得这么多了,详细的看代码吧,里面有注解)。满分代码#include <bits/stdc++.h>using namespace std;#define MAX 500...原创 2020-03-06 23:04:22 · 537 阅读 · 1 评论 -
CSP-201503-1-图像旋转
图像旋转(传送门)一道水题,看代码满分代码#include <bits/stdc++.h>using namespace std;int n;int m;int a[1001][1001];int main(){ cin >> n >> m; for(int i = 0; i < n; i++){ for(int j = ...原创 2020-03-07 11:05:51 · 148 阅读 · 0 评论 -
CSP-201503-2-数字排序
数字排序(传送门)一道水题,用sort就搞定了,看代码满分代码#include <bits/stdc++.h>using namespace std;int n;int a[1001];struct node{ int data; int c;}b[1001];bool cmp(node aa,node bb){ if(aa.c == bb.c){ ...原创 2020-03-07 11:10:55 · 200 阅读 · 0 评论 -
CSP-201503-3-节日
节日(传送门) 一道简单的第三题,我刚开始没看见1850年这个条件,直接从0001年开始计算的,但原理是一样的,首先要搞清楚几个问题 1.判断该月的1号是星期几 2.闰年会多一天,记得判断闰年 3.判断改年之前有多少个闰年就加几天满分代码#include <bits/stdc++.h>using namespace std;int daysOfMonth[12]...原创 2020-03-07 11:26:14 · 293 阅读 · 0 评论 -
CSP-201509-1-数列分段
数列分段(传送门) 一道水题,没什么可说的满分代码#include <bits/stdc++.h>using namespace std;int n;int a[1005];int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } int c =...原创 2020-03-07 11:32:37 · 157 阅读 · 0 评论 -
CSP-201509-2-日期计算
日期计算(传送门) 一道水题,没什么可说的满分代码#include <bits/stdc++.h>using namespace std;int y;int d;int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};int main(){ cin >> y >> d; if((y%4 == ...原创 2020-03-07 11:38:46 · 165 阅读 · 0 评论 -
CSP-201509-3-模板生成系统
问题描述 试题编号: 201509-3 试题名称: 模板生成系统 时间限制: 1.0s 内存限制: 256.0MB ...原创 2020-02-14 23:54:24 · 272 阅读 · 1 评论 -
CSP-201512-1-数位之和
数位之和(传送门) 一道水题,没什么可说的,注意评测的范围,int类型超范围,用long long类型或者字符串类型满分代码#include <bits/stdc++.h>using namespace std;long long n;int sum = 0;;int main(){ cin >> n; while(n>0){ sum ...原创 2020-03-07 11:44:49 · 207 阅读 · 0 评论 -
CSP-201512-2-消除类游戏
消除类游戏(传送门) 一道水题,注意细节,否则可能就是满分与0分的区别,我用两个数组进行判断,先消行后消列,代码里有注解,看代码。满分代码#include <bits/stdc++.h>using namespace std;int n;int m;int a[30][30];int b[31][31]; //辅助数组,专门多出一行一列int main(...原创 2020-03-07 12:06:34 · 752 阅读 · 0 评论 -
CSP-201512-3-画图
问题描述 试题编号: 201512-3 试题名称: 画图 时间限制: 1.0s 内存限制: 256.0MB ...原创 2020-02-15 17:58:17 · 318 阅读 · 0 评论 -
CSP-201604-1-折点计数
折点计数(传送门) 一道水题,没什么可说的满分代码#include <bits/stdc++.h>using namespace std;int n;int main(){ cin >> n; int c = 0; int desc = 0; int asc = 0; int k,v; cin >> k; for(int i...原创 2020-03-07 12:19:00 · 105 阅读 · 0 评论 -
CSP-201604-2-俄罗斯方块
俄罗斯方块(传送门) 一道有意思的题,我特意在给出范围内多加了一层墙壁,用1来表示,处理最后的行,思路是: 1.先找到要掉入的那几列 2.在遍历找到可能出问题的行 3.一层一层的遍历出问题的行,每四行为一个层,如果第一层正常, 遍历第二层(注意返回各层的位置),详细看代码满分代码#include <bits/stdc++.h>using namespace...原创 2020-03-07 12:35:13 · 289 阅读 · 0 评论 -
CSP-201604-3-路径解析
试题编号: 201604-3试题名称:路径解析时间限制:1.0s内存限制:256.0MB问题描述:问题描述 在操作系统中,数据通常以文件的形式存储在文件系统中。文件系统一般采用层次化的组织形式,由目录(或者文件夹)和文件构成,形成一棵树的形状。文件有内容,用于存储数据。目录是容器,可包含文件或其他目录。同一个目录下的所有文件和目录...原创 2020-02-16 16:59:26 · 229 阅读 · 0 评论 -
CSP-201609-1-最大波动
最大波动(传送门) 一道水题,没什么可说的满分代码#include <bits/stdc++.h>using namespace std;int n;int a[10005];int main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } int max...原创 2020-03-07 12:44:38 · 246 阅读 · 0 评论 -
CSP-201609-2-火车购票
火车购票(传送门) 注意:读题读题再读题! 因为这句话(一直90分)===否则应该安排在编号最小的几个空座位中(不考虑是否相邻)。=== 三个小时没了,气煞我也!!!!!!!!就是下面的输入案例输入214 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 5输出1 2 3 46 7 8 911 12 13 1416 17 18 1921 22...原创 2020-03-07 13:58:59 · 232 阅读 · 0 评论 -
CSP-201609-3-炉石传说
试题编号: 201609-3试题名称:炉石传说时间限制:1.0s内存限制:256.0MB问题描述:问题描述 《炉石传说:魔兽英雄传》(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示)。游戏在一个战斗棋盘上进行,由两名玩家轮流进行操作,本题所使用的炉石传说...原创 2020-02-19 13:23:21 · 260 阅读 · 0 评论 -
CSP-201612-1-中间数
中间数(传送门) 一道水题,没什么可说的满分代码#include <bits/stdc++.h>using namespace std;int n;int a[1005];int main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } sort(a+...原创 2020-03-07 14:08:05 · 273 阅读 · 0 评论 -
CSP-201612-2-工资计算
工资计算(传送门) 一道水题,没什么可说的,直接if-elseif-else就可以解决满分代码#include <bits/stdc++.h>using namespace std;int t;double f(int m){ int c = m-3500; if(c < 0){ return 0; }else if(c <= 1500){ ...原创 2020-03-07 14:14:55 · 192 阅读 · 0 评论 -
CSP-201612-3-权限查询
试题编号: 201612-3试题名称:权限查询时间限制:1.0s内存限制:256.0MB问题描述:问题描述 授权 (authorization) 是各类业务系统不可缺少的组成部分,系统用户通过授权机制获得系统中各个模块的操作权限。 本题中的授权机制是这样设计的:每位用户具有若干角色,每种角色具有若干权限。例如,用户 david ...原创 2020-02-20 18:07:15 · 262 阅读 · 0 评论 -
CSP-201703-1-分蛋糕
分蛋糕(传送门) 一道水题,没什么可说的,小心应对,考虑全面即可满分代码#include <bits/stdc++.h>using namespace std;int n;int k;int a[1005];int main(){ cin >> n >> k; for(int i = 0; i < n; i++){ cin ...原创 2020-03-07 14:26:26 · 142 阅读 · 0 评论 -
CSP-201703-2-学生排队
学生排队(传送门) 一道水题,没什么可说的满分代码#include <bits/stdc++.h>using namespace std;int n;int m;struct node{ int n; //学号 int w; //位置}a[1005];bool cmp(node aa,node bb){ return aa.w < bb.w;...原创 2020-03-07 14:44:17 · 178 阅读 · 0 评论 -
CSP-201703-3Markdown
Markdown题目的详细信息(传送门) 这个题目本身难度不是很大,但是但是有一些注意的细节,只需要将string的方法运用熟练,接这道题是没有多大的难度的,首先我给大家提供了一组测试数据,如果这个可以通过,基本上就不会存在扣分的问题。输入样例:* peare1# _Heading_##### Heading## Sub-headingParagrapha are...原创 2020-02-21 17:56:17 · 264 阅读 · 0 评论 -
CSP-201709-1-打酱油
打酱油(传送门) 一道水题,没什么可说的,题目真形象,打酱油,O(∩_∩)O满分代码#include <iostream>#include <algorithm> //sort排序算法using namespace std;int n;int main(){ cin >> n; int coun = n/10; int m = c...原创 2020-03-07 14:49:54 · 218 阅读 · 0 评论 -
CSP-201709-2-公共钥匙盒
公共钥匙盒(传送门) 有点绕,分清是取还是放就好说了,我刚开始没有判断,差点坑死满分代码#include <bits/stdc++.h>using namespace std;struct node{ int w; //钥匙的位置 int t; //放或取钥匙的时间 bool f; //false表示取,true表示放 ...原创 2020-03-07 15:04:57 · 186 阅读 · 0 评论 -
CSP-201709-3-JSON查询
JSON查询题目的详细信息(传送门) 这个题目对于我这种菜鸡来说难度还是有点大的,我刚开始的思路就不正确,以至于我最高只能到达70分,后来看了大佬的解题过程,才知道我大概错在哪里,应该是在解题的时候,没有考虑第一层对象的属性名称和第二层以及多层的属性名称一样的时候,不过我没有再花精力去解决他,如果要改的还得大改,所以这次只当记笔记了,以下是70分代码。ε=(´ο`*)))这是某...原创 2020-02-22 20:44:37 · 245 阅读 · 0 评论 -
CSP-201712-1-最小差值
最小差值(传送门) 一道水题,没什么可说的满分代码#include <iostream>#include <algorithm> //sort排序算法using namespace std;int a[1005];int n;int minn;int main(){ cin >> n; for(int i = 0; i <...原创 2020-03-07 15:11:38 · 194 阅读 · 0 评论 -
CSP-201712-2-游戏
游戏(传送门) 一道水题,没什么可说的满分代码#include <iostream>using namespace std;int a[1005]; //a[i]=-1表示被淘汰,a[i]=0表示未报数,a[i]>0表示还在继续游戏的人int n;int k;int i = 1; //每个人的报数int j = 1; //每个人的编...原创 2020-03-07 15:16:41 · 216 阅读 · 0 评论