CCF CSP 认证
参加第八次CCF CSP认证记录
代码还不知道对不对,过两天出成绩。
成绩出来了,310分。
100+100+100+10+0;
考试13:27开始,17:30结束,提交第4题后不再答题,只是检查前四题的代码
第一次提交:
1 13:34
2 14:00左右
3 15:32
4 16:56
5
最后一次提交:
1 13:34
2 16:06
3 15:32
4 16:56
5
代码行数(不算空行,算无用的include,算注释掉的部分)
1 23
2 50
3 101
4 71
5
共 245 行
源代码:
1
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<string>
#include<stack>
#include<vector>
using namespace std;
int main(int argc, char** argv) {
int n;
cin>>n;
int * a=new int[n];
;i<n;i++){
cin>>a[i];
}
;
;i<n;i++){
];
t=t>?t:-t;
m=m<t?t:m;
}
cout<<m;
;
}
2
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<string>
#include<stack>
#include<vector>
using namespace std;
int main(int argc, char** argv) {
];
;i<;i++){
a[i]=;
}
int n,t;
cin>>n;
;i<n;i++){
cin>>t;
;
;i<;i++){
if(a[i]>=t){
;j<t;j++){
cout<<i*+-a[i]+j+<<" ";
}
cout<<endl;
a[i]-=t;
flag=;
break;
}
}
){
;i<;i++){
){
;j<t;j++){
cout<<i*+-a[i]+j+<<" ";
}
a[i]-=t;
break;
}else{
;j<a[i];j++){
cout<<i*+-a[i]+j+<<" ";
}
t-=a[i];
a[i]=;
}
}
cout<<endl;
}
}
delete []a;
;
}
3
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<string>
#include<stack>
#include<vector>
using namespace std;
struct suicong{
int hth;
int att;
suicong(int h,int a){
hth=h;
att=a;
}
};
struct ying{
int hth;
int att;
ying(){
hth=;
att=;
}
};
int main(int argc, char** argv) {
vector<suicong>* war=];
//vector<suicong> war0;
//vector<suicong> war1;
//suicong* ying0=new suicong(30,0,1);
//suicong* ying1=new suicong(30,0,1);
ying ying[];
//war[0].push_back(*ying0);
//war[1].push_back(*ying1);
int n;
cin>>n;
;
//int y[2];
;i<n;i++){
string str;
cin>>str;
if(str=="summon"){
int p,h,a;
cin>>p>>a>>h;
suicong* temp=new suicong(h,a);
war[t].insert(war[t].begin()+p-,*temp);
}
if(str=="attack"){
int d,a;
cin>>a>>d;
){
ying[-t].hth-=war[t].at(a-).att;
war[t].at(a-).hth-=ying[-t].att;
).hth<=){
war[t].erase(war[t].begin()+a-);
}
}
else{
//cout<<t<<" "<<war[t].size()<<" "<<war[1-t].size();
war[-t].at(d-).hth-=war[t].at(a-).att;
war[t].at(a-).hth-=war[-t].at(d-).att;
).hth<=){
war[t].erase(war[t].begin()+a-);
}
-t].at(d-).hth<=){
war[-t].erase(war[-t].begin()+d-);
}
}
}
if(str=="end"){
t=-t;
}
/*cout<<0<<" "<<ying[0].hth<<" "<<war[0].size()<<" ";
for(int i=0;i<war[0].size();i++){
cout<<war[0].at(i).hth<<" ";
}cout<<endl;
cout<<1<<" "<<ying[1].hth<<" "<<war[1].size()<<" ";
for(int i=0;i<war[1].size();i++){
cout<<war[1].at(i).hth<<" ";
}cout<<endl;*/
}
].hth<=){
cout<<-<<endl;
}else
].hth<=){
cout<<<<endl;
}else{
cout<<<<endl;
}
cout<<ying[].hth<<endl;
cout<<war[].size()<<" ";
;i<war[].size();i++){
cout<<war[].at(i).hth<<" ";
}
cout<<endl;
cout<<ying[].hth<<endl;
cout<<war[].size()<<" ";
;i<war[].size();i++){
cout<<war[].at(i).hth<<" ";
}
cout<<endl;
;
}
4
此代码是错误的
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<string>
#include<stack>
#include<vector>
#include<queue>
using namespace std;
struct road{
int to;
int len;
road(int t,int l){
to=t;len=l;
}
};
struct city{
//int num;
;
;
vector<road> v;
void addroad(int t,int len){
road* r=new road(t,len);
v.push_back(*r);
}
};
int get(city* cs,int i,int j){
;k<cs[i].v.size();k++){
if(cs[i].v.at(k).to==j)return cs[i].v.at(k).len;
}
;
}
int main(int argc, char** argv) {
int n,m;
cin>>n>>m;
city* cs=];
;i<m;i++){
int a,b,c;
cin>>a>>b>>c;
cs[a].addroad(b,c);
cs[b].addroad(a,c);
}
cs[].tlen=;
queue<int> q;
q.push();
while(!q.empty()){
int t=q.front();
q.pop();
;i<cs[t].v.size();i++){
if(cs[cs[t].v.at(i).to].tlen>cs[t].tlen+cs[t].v.at(i).len){
cs[cs[t].v.at(i).to].tlen=cs[t].tlen+cs[t].v.at(i).len;
cs[cs[t].v.at(i).to].pre=t;
q.push(cs[t].v.at(i).to);
}
if(cs[cs[t].v.at(i).to].tlen==cs[t].tlen+cs[t].v.at(i).len){
if(get(cs,cs[cs[t].v.at(i).to].pre,cs[t].v.at(i).to)>cs[t].v.at(i).len){
cs[cs[t].v.at(i).to].tlen=cs[t].tlen+cs[t].v.at(i).len;
cs[cs[t].v.at(i).to].pre=t;
q.push(cs[t].v.at(i).to);
}
}
}
}
/* for(int i=0;i<n+1;i++){
cout<<i<<" "<<cs[i].pre<<" "<<get(cs,i,cs[i].pre)<<endl;
}*/
;
;i<n+;i++){
ll+=get(cs,i,cs[i].pre);
}
cout<<ll;
;
}
2016.9.11 晚8:40
END
CCF CSP 认证的更多相关文章
- 【生活】记第一次参加CCF CSP认证
2018年03月18日 CCF CSP认证 三月份的这次csp认证,我之前是没报名的,一来自己还没什么准备,二来去年的那次认证我也没参加,开考前的一个礼拜,从朋友那得知,这次学校团体报名的名额还没报满 ...
- CCF CSP认证考试在线评测系统
关于 CCF CSP 认证考试在线评测系统 CCF CSP 认证考试简介 CCF 是中国计算机学会的简称.CCF 计算机软件能力认证(简称 CCF CSP 认证考试)是 CCF 于 2014 年推出, ...
- 第16次CCF CSP认证-第5题-317 号子任务(subtask317)-图论最短路径
[题目背景]“你在平原上走着走着,突然迎面遇到一堵墙,这墙向上无限高,向下无限深,向左无限远,向右无限远,这墙是什么?”——<流浪地球>原著我们带着地球去流浪了,为了处理流浪过程中可能会发 ...
- CCF CSP认证考试试题
1. 201803-1 跳一跳 试题编号: 201803-1 试题名称: 跳一跳 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 近来,跳一跳这款小游戏风靡全国,受到不少玩家的 ...
- CCF CSP/CCSP报名费优惠的方法以及常见疑问
目录 1. 本文地址 2. 认证作用 2.1. 高校认可 2.2. 赛事认可 2.3. 企业认可 3. 报名费价格及获取优惠的方法 3.1. CCF CSP 3.2. CCF CCSP 4. 语言与I ...
- CCF CSP 201703-3 Markdown
CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201703-3 Markdown 问题描述 Markdown 是一种很流行的轻量级标记语言(l ...
- CCF CSP 201312-3 最大的矩形
CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201312-3 最大的矩形 问题描述 在横轴上放了n个相邻的矩形,每个矩形的宽度是1,而第i( ...
- CCF CSP 201609-3 炉石传说
CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201609-3 炉石传说 问题描述 <炉石传说:魔兽英雄传>(Hearthston ...
- CCF CSP 201403-3 命令行选项
CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201403-3 命令行选项 问题描述 请你写一个命令行分析程序,用以分析给定的命令行里包含哪些 ...
随机推荐
- android 实现点击edittext的“小眼睛”切换明密文
android 实现点击edittext的“小眼睛”切换明密文 版权声明:本文为博主原创文章,未经博主允许不得转载. 很多时候,我们为了用户的隐私安全,需要在密码输入的时候,显示密文.为了更 ...
- Java list 转字符串并加入分隔符的方法
import org.apache.commons.lang.StringUtils; List<String> list=new ArrayList<String>(); l ...
- SQL学习 DECODE
from 百度百科: DECODE有什么用途呢? 先构造一个例子,假设我们想给这些职员加工资,其标准是:工资在8000元以下的加20%:工资在8000元或以上的加15%,通常的做法是,先选出记录中的工 ...
- MySQL数据库事务及其特性
一.事务概念 事务就是一个程序执行单元,里面的操作要么都做,要么都不做. 二.事务特性 事务有四个非常重要的特性(ACID): 原子性(Atomicity):事务是不可分割的整体,所有操作要么全做,要 ...
- Mac系统下Mysql存储数据报错 ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect string value
比如如下mysql操作插入数据: const mysql = require('mysql'); /* createConnection方法创建一个表示与Mysql数据库服务器之间连接的 Connec ...
- Python排序算法——冒泡排序
有趣的事,Python永远不会缺席! 如需转发,请注明出处:小婷儿的python https://www.cnblogs.com/xxtalhr/p/10786904.html 一.冒泡排序(Bubb ...
- 将代码托管到github服务器之SSH验证
内容中包含 base64string 图片造成字符过多,拒绝显示
- Nowcoder217D msc的背包 背包、生成函数、组合
传送门 发现这是一个背包问题,而\(k\)又很大,考虑生成函数方式解决这个问题. 对于体积为\(1\)的物品的生成函数为\(\frac{1}{1 - x}\),体积为\(2\)的物品的生成函数为\(\ ...
- cmd执行超大sql文件
osql -S 127.0.0.1 -U sa -P 123456 -i d:\test.sql osql为SQL Server的命令,要在cmd中执行该命令,一般安装完SQL Server后该命令对 ...
- 编写python程序和运行.py文件的方法步骤
前提:已安装好 Subliume Test 3 且已经添加好python编译系统,已安装好python3.7 一.新建一个文本文档,将后缀名改为.py 二.使用 Subliume Test 3 打开该 ...