
CCF
萌萌的咕咕
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
CCF 202006-2 稀疏向量(100)
#include <iostream>#include <map>using namespace std;typedef long long LL;map <int, int> mp;int main(){ ios::sync_with_stdio(false);//cin<<scanf<cin(关闭流同步)此处是关键!!!使用了这一句就不要用scanf和printf啦! int n, a, b, index, value; L原创 2020-08-20 17:06:00 · 324 阅读 · 0 评论 -
CCF 201509-1 数列分段
问题分析:这个题可以不用数组,直接对读入的数据进行判断。提交后100分的C++程序如下#include<cstdio>using namespace std;int main(){ int n, v, k, ans = 0; scanf("%d", &n); scanf("%d", &v); ans ++; for(int i = 0; i <...原创 2019-09-09 10:48:36 · 185 阅读 · 0 评论 -
CCF 201409-1 相邻数对
代码1(朴素版~)#include <iostream>#include <math.h>using namespace std;const int N = 1005;int a[N];int main(){ int n, ans = 0; cin >> n; for(int i = 0; i < n; i ++) { cin >> a[i]; } for(int i =原创 2020-08-08 16:07:39 · 113 阅读 · 0 评论 -
CCF 202006-1 线性分类器
代码1:正常思路+STL/*线性分类器*/#include <iostream>#include <vector>using namespace std;typedef long long LL; //此处是关键struct point{ int xn, yn; char c;};vector<point> a; //存储A类点vector<point> b; //存储B类点int main(){ int n, m, cnta原创 2020-07-27 11:19:16 · 811 阅读 · 0 评论 -
CCF 201912-2 回收站选址
#include<iostream>#include<map>#include<string.h> using namespace std;const int N = 1000;int count[5];pair<int, int> p[N];int main(){ int n; map<pair<int, int>, int> ps; cin >> n; for(int i = 0; i &原创 2020-06-27 10:10:28 · 135 阅读 · 0 评论 -
CCF 201912-1 报数
#include<iostream>using namespace std;int a[5] = {0};int main(){ int n; int count = 0; cin >> n; for(int i = 1; ; i ++) { //判断是否为7的倍数或者是否含有7 if(i % 7 == 0 || i % 10 == 7 || i / 10 % 10 == 7 || i / 100 == 7) { a[i%4] ++; //找原创 2020-05-13 13:56:20 · 164 阅读 · 0 评论 -
CCF 201412-2 Z字形扫描
#include<iostream>using namespace std;const int East = 0;const int South = 1;const int Southwest = 2;const int Northeast = 3;const int N = 510;int a[N][N];struct node{ int x, y;}dir...原创 2019-09-14 10:58:52 · 93 阅读 · 0 评论 -
CCF 201803-2 碰撞的小球
问题分析:关键是处理好如何判断两个小球碰撞以及碰撞之后的速度变化问题。代码如下#include<cstdio>using namespace std;const int N = 110;struct node{ int address; int v;}ball[N];int main(){ int n, l, t; scanf("%d%d%d", &...原创 2019-09-12 17:34:49 · 126 阅读 · 0 评论 -
CCF 201903-2 二十四点
问题分析:中缀表达式转后缀表达式,然后计算后缀表达式的值。此题用栈储存操作符,用队列储存后缀表达式。问题分析:#include<cstdio>#include<iostream>#include<stack>#include<queue>#include<map> #include<cstring>using ...原创 2019-09-12 16:42:37 · 195 阅读 · 0 评论 -
CCF 201409-2 画图
问题分析:把扫描过的方格标记一下,统计未扫描的方格数量。代码如下#include<cstdio>using namespace std;const int N = 110;bool vis[N][N] = {false};int main(){ int n, x1, y1, x2, y2; int ans= 0; scanf("%d", &n); whil...原创 2019-09-12 08:31:42 · 97 阅读 · 0 评论 -
CCF 201512-2 消除类游戏
问题分析:另开一个数组,标记需要消除的颜色。代码如下#include<cstdio>using namespace std;const int N = 35;int arr[N][N];bool clear[N][N] = {false};int main(){ int n, m; scanf("%d%d", &n, &m); for(int i ...原创 2019-09-12 08:53:48 · 170 阅读 · 0 评论 -
CCF 201809-2 买菜
问题分析:从题目中具体的场景中抽象出本质,其实就是求相交长度,求两个数的最大值或者最小值可以直接用头文件algorithm里面的max()和min()。代码如下#include<cstdio>#include<algorithm>using namespace std;const int N = 2000 + 10;int a[N], b[N], c[N], d...原创 2019-09-13 19:57:01 · 170 阅读 · 0 评论 -
CCF 201712-2 游戏
问题分析:一开始没搞懂怎么让循环终止,其实就是几个小孩转圈圈,淘汰了的就出局,其他人继续转圈圈。代码如下#include<cstdio>#include<queue>using namespace std;int main(){ queue<int> q; int n, k, cur, t = 1; scanf("%d%d", &n, ...原创 2019-09-13 21:31:26 · 116 阅读 · 0 评论 -
CCF 201812-2 小明放学
问题分析:做一个红绿黄时间轴,题目给出的t是倒计时显示牌上显示的数字,先求出出发时t在时间轴上的时间,然后计算出time时间后红绿黄灯的状态,返回需要的时间。代码如下#include<cstdio>using namespace std;typedef long long ll;ll r, g, y;ll Ans(ll k, ll t, ll time){ if(k ...原创 2019-09-14 10:00:11 · 344 阅读 · 0 评论 -
CCF 201703-2 学生排队
#include<cstdio>using namespace std;const int N = 1000 + 10;int a[N], b[N];//a[N]记录学号的位置 int main(){ int n, m, p, q; scanf("%d%d", &n, &m); for(int i = 1; i <= n; i ++) { a...原创 2019-09-14 17:02:52 · 138 阅读 · 0 评论 -
记录小菜菜第一次参加CCF考试
啊!我终于也是参加过CCF的人了,哈哈哈,发出了姨母般的狂笑!下午一点半开始考试,考试时长四个小时,去考场的路上就开始紧张,嘤嘤嘤,虽然和舍友一起去的考场,但还是很紧张,还好考场里面随便坐,左边是一个对面宿舍的妹子,右边是我班的女生,倒没有太紧张。我本来想着怎么着第一题应该没问题吧,结果做第一题的时候心态就崩了一次,本来感觉自己写的挺对的,结果输入两行以后程序就异常终止。。。哇!当时气氛突然尴尬了...原创 2019-09-15 21:13:07 · 303 阅读 · 3 评论 -
CCF 201909-1 小明种苹果
#include<iostream>#include<cstdio>#include<algorithm>#include<string.h>using namespace std;const int N = 1000 + 10;int a[N], b[N];int main(){ int n, m, v; scanf("%d%d...原创 2019-10-06 12:49:46 · 160 阅读 · 0 评论 -
CCF 201909-2 小明种苹果(续)
#include<cstdio>#include<iostream>#include<string.h>using namespace std;const int N = 1000 + 10;bool drop[N];int main(){ int n, m, num, v; int t = 0, d = 0, e = 0; scanf("%...原创 2019-10-06 15:31:33 · 455 阅读 · 5 评论 -
CCF 201903-1 小中大
问题分析:对一组数据进行排序,输出最大值,中位数,最小值,输出中位数时要注意,如果是小数要保留一位小数。提交后100分的C++程序如下#include<cstdio>#include<algorithm>using namespace std;typedef long long ll;const int M = 1e+7;int a[M+10];int ma...原创 2019-09-08 15:53:30 · 121 阅读 · 0 评论 -
CCF 201412-1 门禁系统
问题分析:把数据作为数组下标进行处理。提交后100分的C++程序如下#include<cstdio>#include<cstring>using namespace std;const int N = 1010;int a[N];int main(){ int n, v; scanf("%d", &n); memset(a, 0, sizeof...原创 2019-09-10 07:48:35 · 97 阅读 · 0 评论 -
CCF 201712-1 最小差值
问题分析:这个题可以先把所有的数据进行排序,最小值肯定出现在相邻两个数之间,而且排序以后不用考虑正负。提交后100分的C++程序如下#include<cstdio>#include<algorithm>using namespace std;const int N = 1010;int a[N];int main(){ int n; scanf("%d"...原创 2019-09-09 08:39:27 · 399 阅读 · 0 评论 -
CCF 201809-1 卖菜
#include<cstdio>using namespace std;const int M = 1010;int a[M], b[M];int main(){ int n, ans; scanf("%d", &n); for(int i = 0; i < n; i ++) { scanf("%d", &a[i]); } b[0] = ...原创 2019-09-08 19:06:19 · 114 阅读 · 0 评论 -
CCF 201812-1 小明上学
问题分析:统计上学所用时间,没有红绿灯时直接记录通过道路所用的时间,遇到红灯时需要等倒计时的秒数,遇到黄灯时,除了倒计时以外还要加上红灯的时间,绿灯不需要等。提交后100分的C++程序如下#include<cstdio>using namespace std;int main(){ int r, g, y, n, k, t; int ans = 0; scanf("%d...原创 2019-09-08 18:29:14 · 177 阅读 · 0 评论 -
CCF 201503-2 数字排序
问题分析:需要统计每个数字出现的次数,再按照出现次数的大小顺序从大到小进行输出,如果次数一样多,则先输出数值小的。可以定义一个结构体,包含数字和次数这两个变量,然后对数据进行排序。提交后100分的C++程序如下(第一种排序方式)#include<cstdio>#include<algorithm>using namespace std;const int maxn...原创 2019-09-04 14:17:35 · 125 阅读 · 0 评论 -
CCF 201609-2 火车购票
问题分析:用数组a[20]表示每排被占用的座位数,逐排扫描,先放相邻编号的座位,然后再放不连续的座位。#include<cstdio>#include<iostream>#include<cstring>using namespace std;int main(){ int a[20], n, p; //数组表示每排被占用了多少个 mems...原创 2019-08-29 10:23:55 · 192 阅读 · 0 评论 -
CCF 201709-2 公共钥匙盒
问题分析这个题可以划分为两个过程,每个过程对应一个时间点,处理好数据以后加入优先队列中,然后遍历队列,模拟取钥匙和还钥匙的过程。提交后100分的C++程序如下// 201709-2 公共钥匙盒 #include<cstdio>#include<queue>using namespace std;struct node{ int time; //取还钥匙的时间点...原创 2019-08-26 18:24:15 · 180 阅读 · 0 评论 -
CCF 201312-2 ISBN号码
问题分析:字符串和字符的处理问题,可以用字符数组,也可以直接进行字符串处理。其中有两个注意点,一是字符与整数之间的转换,二是识别符为’X’的情况:输入的字符串最后的识别符为’X’;计算出的识别码为10。提交后100分的C++程序如下(字符数组)//201312-2 ISBN号码#include<cstdio>using namespace std;char a[13];in...原创 2019-08-22 15:16:18 · 132 阅读 · 0 评论 -
CCF 201803-1 跳一跳
问题分析:之前做过一遍了,这次做还是没处理好,这个题关键的地方就是怎么处理连续跳到中心的时候分数的累计。提交后100分的C++程序如下#include<cstdio>using namespace std;int main(){ int n, m = 2; int ans = 0; while(scanf("%d", &n) != EOF &&...原创 2019-09-09 08:40:50 · 102 阅读 · 0 评论 -
CCF 201709-1 打酱油
问题分析:要想看最多可以买多少瓶酱油,肯定要先买50元的,再买30元的,再买10元的。提交后100分的C++程序如下#include<cstdio>using namespace std;int main(){ int n, ans = 0; scanf("%d", &n); ans += (n / 50) * 7 + (n % 50 / 30) *4 + n ...原创 2019-09-09 08:50:38 · 106 阅读 · 0 评论 -
CCF 201403-1 相反数
提交后100分的C++程序如下#include<cstdio>using namespace std;const int N = 510;int a[N];int main(){ int n, ans = 0; scanf("%d", &n); for(int i = 0; i < n; i ++) { scanf("%d", &a[i])...原创 2019-09-10 07:47:08 · 101 阅读 · 0 评论 -
CCF 201312-1 出现次数最多的数
问题分析:最近学习了STL里面的map,可以利用数字与出现次数的映射,而且map还可以根据键从小到大排序,用map解决此问题很方便。提交后100分的C++程序如下#include<cstdio>#include<map>using namespace std;int main(){ map<int, int> count; int n, v; ...原创 2019-09-10 07:46:45 · 100 阅读 · 0 评论 -
CCF 201503-1 图像旋转
问题分析:这个题只要注意一下输出就可以了。提交后100分的C++程序如下#include<cstdio>using namespace std;const int N = 1010;int a[N][N];int main(){ int n, m; scanf("%d%d", &n, &m); for(int i = 0; i < n; i +...原创 2019-09-10 07:48:56 · 94 阅读 · 0 评论 -
CCF 201512-1 数位之和
问题分析:最近刚看了STL里面的string,就用这个做了一下这个题,要注意一下字符串与数字之间的转换。提交后100分的C++程序如下(一)#include<iostream>#include<string>using namespace std;int main(){ string str; int ans = 0; cin >> str;...原创 2019-09-09 10:33:30 · 92 阅读 · 0 评论 -
CCF 201604-1 折点计数
问题分析:这是个小水题。提交后100分的C++程序如下#include<cstdio>#include<cmath>using namespace std;const int N = 1010;int a[N];int main(){ int n, ans = 0; scanf("%d", &n); for(int i = 0; i <...原创 2019-09-09 10:17:19 · 119 阅读 · 0 评论 -
CCF 201609-1 最大波动
问题分析:题目给的数据范围不大,用数组处理完全没问题,要注意这个题用到了绝对值函数,要放在头文件下。提交后100分的C++程序如下#include<cstdio>#include<cmath>using namespace std;const int N = 1010;int a[N];int main(){ int n; scanf("%d", &a...原创 2019-09-09 10:07:40 · 138 阅读 · 0 评论 -
CCF 201612-1 中间数
问题分析:首先要弄清楚中间数的定义,如果存在某个数,大于它的整数数量等于小于它的整数数量,则称其为中间数。把一组数进行排序,如果存在中间数,则肯定出现在一组数据的最中间,只需要统计大于和小于这个数的数字个数是否相等即可。提交后100分的C++程序如下#include<cstdio>#include<algorithm>using namespace std;con...原创 2019-09-09 09:47:08 · 109 阅读 · 0 评论 -
CCF 201703-1 分蛋糕
问题分析:这个题需要注意的是当分到最后蛋糕重量不足k时,也要把蛋糕给一个小朋友。提交后100分的C++程序如下#include<cstdio>#include<algorithm>using namespace std;int main(){ int n, k, v, all = 0; int count = 0;//记录分到蛋糕的小朋友的数量 scan...原创 2019-09-09 09:08:52 · 123 阅读 · 0 评论 -
CCF 201403-2 窗口
问题分析:用鼠标点击重叠的窗口,输出窗口的编号,再将被点击的窗口移到最顶层。如果未点击到窗口,则输出"IGNORED"。提交后100分的C++程序如下//201403-2 窗口 #include<iostream>using namespace std;struct node{ int x1, x2, y1, y2;}a[10];int main(){ int n,...原创 2019-08-23 17:58:21 · 167 阅读 · 0 评论