CCF-CSP
中国计算机学会发起的编程算法设计比赛
yunxiaoMr
where there great love,there are always miracles!Just work hard and be yourself, and then you will succeed!
展开
-
CCF-CSP 20200604 1246
我就是个猪头肉,把一道动态规划的题暴力求解,28分,随后有时间再优化做~ 呜呜呜import mathimport reif __name__ == '__main__': n = input() string_num = input() n = int(n) cnt = 1 in_str = "2" while(cnt<n): new_str = "" for i in range(len(in_str).原创 2020-12-09 21:39:43 · 156 阅读 · 0 评论 -
CCF-CSP 20181204 数据中心(满分)
#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int N = 5e4+10; const int M = 1e5+10;int F[N]; //并查集,用于找你和我共同的爸爸 int tol; //存储一个全局的边数 struct Edge{ int u,v,w;}e[M];bool cmp(Edge a,Edge b.原创 2020-12-09 17:26:15 · 160 阅读 · 0 评论 -
CCF-CSP 20190305 317号子任务(满分)
Floyd 超时 30分#include<iostream>#include<algorithm>#include<cstring>using namespace std;#define inf 0x3f3f3f3f static const int N=10001;int E[N][N],kind[N];struct Node{ int k,e;}tmp[N];bool cmp(Node P,Node Q){ if(P.k==Q.k) ret原创 2020-12-06 13:15:04 · 573 阅读 · 0 评论 -
CCF-CSP 20160404:游戏
#include<iostream>#include<cstring>#include<queue>using namespace std;#define N 101#define M 101#define T 5000 //10001内存超出,评测范围T为9999,没想明白5000的维度竟然满分了 int map[M][N][T];struct node{ int x,y,time;};struct Pos{ int x,y;}pos.原创 2020-12-05 17:07:28 · 147 阅读 · 0 评论 -
CCF-CSP 20191202:回收站
本题没什么坑,注意一下数据范围就好,有负整数的评测样例.#include<iostream>using namespace std;#define N 10001int check(long tmp_x,long tmp_y,long x,long y){ if(tmp_x==x&&tmp_y==y) return 0; if(tmp_x==x&&tmp_y==(y-1)) return 1; if(tmp_x==x&&t原创 2020-12-02 21:13:33 · 180 阅读 · 0 评论 -
CCF-CSP 20190302:二十四点
#include<iostream>#include<vector> using namespace std;int solve(int data1,char op,int data2){ if(op=='+'){ return data1+data2; }else if(op=='-'){ return data1-data2; }else if(op=='x'){ return data1*data2; }else if(op=='/'){ re.原创 2020-11-29 22:16:54 · 164 阅读 · 0 评论 -
CCF-CSP 20180302:小球碰撞
#include<iostream>#include<algorithm>#include<vector>using namespace std;#define N 101#define T 101#define L 1001int pos[N];int v[N];int id[N];bool check(int pos[],int j,int l,int n){ bool flag = false; if(pos[j]==0||pos[j].原创 2020-11-27 18:36:15 · 295 阅读 · 0 评论 -
CF-CSP 202009-1:称检测点查询
#include<iostream> #include<cmath>#include<algorithm>using namespace std;#define N 201int pos[2][N];double dis[N];int main(){ int n,X,Y; cin>>n>>X>>Y; int i=0; while(i<n){ cin>>pos[0][i]>>pos.原创 2020-11-02 21:50:55 · 311 阅读 · 0 评论 -
CCF-CSP201909-2:小明种苹果(续)
#include<iostream>#include<cmath>using namespace std;#define N 1001#define M 1001int tree[N],list[N];bool drop[N];int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ ...原创 2019-10-03 10:28:52 · 488 阅读 · 0 评论 -
CCF-CSP201909-1:小明种苹果
#include<iostream>#include<cmath>using namespace std;#define N 1001#define M 1001int tree[N],res[N],list[N];int main(){ int n,m; cin>>n>>m; int tmp[m+1]; for(int i=...原创 2019-10-03 10:27:35 · 303 阅读 · 0 评论 -
CCF篇:201812-2 小明放学 暨CCF考前一天经验总结
明天考第十六次CCF,今天下午刷了一下上次考的题。这个第二题,上次考的时候,得了40分,一直以来也没有时间来分析,今天重新把这道题的逻辑写了一遍,发现得了60分,分析了一下上次的代码,才发现当时对测试数据的定义范围N为100,得了40分。这次得了60分,显然是高范围的数据评测有问题。下面是上次40分的代码(代码设计有些冗余):#include<iostream>us...原创 2019-03-16 19:30:47 · 297 阅读 · 0 评论 -
CCF篇:201809-2 买菜
说实话,比赛没遇上2018年9月份的机会真是血亏!无脑暴力一下就就出来了!#include<iostream>using namespace std;#define M 1000001int time_1[M];int time_2[M];int main(){ int n; cin>>n; int H[n][2],W[n][2]; for(int ...原创 2018-12-12 22:20:13 · 237 阅读 · 0 评论 -
CCF篇:201604-2 俄罗斯方块
#include<iostream> using namespace std;const int M=15;const int N=10;const int C=4;int map[M+1][N];int pic[C][C];int col;struct flag_pic{ int rows; int cols;}flag[C];int main(){ fo...原创 2018-12-02 21:13:44 · 246 阅读 · 0 评论 -
CCF篇:201509-2 日期计算
#include<iostream>#include<algorithm>using namespace std; int yearP[12] = {31,28,31,30,31,30,31,31,30,31,30,31};int yearR[12] = {31,29,31,30,31,30,31,31,30,31,30,31};bool isRunYear(i...原创 2018-11-29 23:46:00 · 111 阅读 · 0 评论 -
CCF篇:201512-2 消除类游戏
#include<iostream>using namespace std;#define N 31#define M 31int a[M][N];int b[M][N];int c[M][N];void row(int a[M][N]){ for(int i=0;i<M;i++){ int temp=-1,count=1; for(int j...原创 2018-11-29 23:43:57 · 124 阅读 · 0 评论 -
CCF篇:那些年我们遇到的“小坑”Problem总结
小总结:今天水CCF的基础题,练练速度和一次性的正确率,果然颇有收货,下面的错误可能是我们不经意间就会失误的操作,到后期若想刷刷有点难度的题,在这些小失误上浪费时间实在不值得,下面罗列一下我的总结也可以作为我以后的小笔记。声明变量n之后,然后在声明数组a[n]之前一定要对n进行赋初值,Problem:会发生编译错误,连最初始的第一条语句都不进行。CCF题中要求怎么输出就怎么输出,...原创 2018-11-10 13:09:01 · 542 阅读 · 0 评论 -
CCF篇:201503-1 图像旋转 满分评测
今天水题水到CCF201503-1 图像旋转题,代码逻辑写完后,测试低维数据,完全正确,可是提交结果后,只是得了80分,编译结果时运行错误。如果是运行错误,逻辑混乱,肯定是得不了80分的,有个10分就不错了。因此,我猜想一定时高维评测结果有问题。刚开始,将n,m变量定义为long,结果还是80分。显然这是行不通。后来,我查到评测为1<=n,m<=1000,不如声明数组为a[1000...原创 2018-11-10 11:39:36 · 434 阅读 · 2 评论 -
CCF篇:2013-12-1:出现次数最多的数
问题描述 给定n个正整数,找出它们中出现次数最多的数。如果这样的数有多个,请输出其中最小的一个。输入格式 输入的第一行只有一个正整数n(1 ≤ n ≤ 1000),表示数字的个数。 输入的第二行有n个整数s1, s2, …, sn (1 ≤ si ≤ 10000, 1 ≤ i ≤ n)。相邻的数用空格分隔。输出格式 输出这n个次数中出现次数最多的数。如果这样的数有多个,输出其...原创 2018-11-06 23:20:42 · 99 阅读 · 0 评论 -
算法篇:最小生成树(Kruscal&&Prim)
时间限制: 1 s 空间限制: 128000 KB 题目等级 : 白银 Silver题目描述 Description农民约翰被选为他们镇的镇长!他其中一个竞选承诺就是在镇上建立起互联网,并连接到所有的农场。当然,他需要你的帮助。 约翰已经给他的农场安排了一条高速的网络线路,他想把这条线路共享给其他农场。为了使花费最少,他想铺设最短的光纤去连接所有的农场。 你将得到一份各农场之间连接...原创 2018-10-29 21:38:42 · 120 阅读 · 0 评论 -
CCF篇:CSP认证 2017-12-2 游戏
问题描述 有n个小朋友围成一圈玩游戏,小朋友从1至n编号,2号小朋友坐在1号小朋友的顺时针方向,3号小朋友坐在2号小朋友的顺时针方向,……,1号小朋友坐在n号小朋友的顺时针方向。 游戏开始,从1号小朋友开始顺时针报数,接下来每个小朋友的报数是上一个小朋友报的数加1。若一个小朋友报的数为k的倍数或其末位数(即数的个位)为k,则该小朋友被淘汰出局,不再参加以后的报数。当游戏中只剩下一个小朋友...原创 2018-10-19 17:54:51 · 331 阅读 · 0 评论