CSP练习记录
人间理想无谓
当笔记用
展开
-
201909-1小明种苹果
代码:#include<iostream>using namespace std;const int N = 2000;int num[N][N]={0};int main(){ int n; int m; cin>>n>>m; for(int i=0;i<n;i++) { for(int j=0;j<m+1;j++) { cin>>num[i][j]; } } int total = 0;..原创 2021-07-16 19:23:02 · 98 阅读 · 0 评论 -
201912-1 报数
解题注意:首先不用分类讨论,因为n<100还是n>100都可以n/100。n是计数记到的个数,所以如果有需要跳过的,就需要n++;多给循环加一个;n<666,但是,数会数到大于700,所以考虑i/100%7.代码:#include<bits/stdc++.h>using namespace std;const int N = 670; int main() { int n; cin>>n; int a=0; int b=0;原创 2021-07-16 19:23:09 · 95 阅读 · 0 评论 -
202006-1线性分类器
代码:#include<bits/stdc++.h>using namespace std;const int N = 1e3+1;int main(){ int m; int n; cin>>n>>m; struct point { int x; int y; char type; }; struct point p[N]; for(int i=0;i<n;i++) { cin>>...原创 2021-07-15 16:49:01 · 109 阅读 · 0 评论 -
结构体数组的实现
#include<iostream>using namespace std;int main(){ struct point{ int x; int y; char type; }; struct point p[3]; for(int i=0;i<3;i++) { cin>>p[i].x>>p[i].y>>p[i].type; } cout<<endl; for(int i=0;i<3;i原创 2021-07-15 13:42:56 · 96 阅读 · 0 评论 -
202009-1 称检测点查询
试题编号: 202009-1试题名称: 称检测点查询时间限制: 1.0s内存限制: 256.0MB题目背景2020 年 6 月 8 日,国务院联防联控机制发布《关于加快推进新冠病毒核酸检测的实施意见》,提出对“密切接触者”等八类重点人群“应检尽检”,其他人群“愿检尽检”。问题描述某市设有 n 个核酸检测点,编号从 1 到 n,其中 i 号检测点的位置可以表示为一个平面整数坐标(xi, yi)。为方便预约核酸检测,请根据市民所在位置(x, y) ,查询距其最近的三个检测点。多个检测点距离相同原创 2021-07-15 13:21:12 · 118 阅读 · 0 评论 -
sort快速排序函数的使用
头文件为#include或者万能头文件#include<bits/stdc++.h>#include<bits/stdc++.h>using namespace std;int main(){ int n; cin>>n; int a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } sort(a,a+n); for(int i=0;i<n;i++) { cout<<a[原创 2021-07-15 13:18:31 · 92 阅读 · 0 评论 -
202012-2期末预测之最佳阈值
样例1输入60 01 01 13 15 17 1样例1输出3样例1解释按照规则一,最佳阈值的选取范围为0,1,3,5,7。θ=0时,预测正确次数为4;θ=1时,预测正确次数为5;θ=3时,预测正确次数为5;θ=5时,预测正确次数为4;θ=7时,预测正确次数为3。阈值选取为1或3时,预测准确率最高;所以按照规则二,最佳阈值的选取范围缩小为1,3。依规则三,θ*=max1,3=3。样例2输入85 15 05 02 13 04 0100000000 11.原创 2021-07-15 13:15:35 · 282 阅读 · 0 评论 -
csp—202012-01期末预测之安全指数
样例1输入62 6010 1000 700 0-10 5010 60样例1输出1220样例1解释y=ReLU(1220)=1220样例2输入2-10 100-1 15样例2输出0样例2解释y=ReLU(-1015)=0代码实现:#include<iostream>using namespace std;int main(){ int n; cin>>n; int w[n] = {0}; int score[n] = {0};.原创 2021-07-15 13:08:18 · 73 阅读 · 0 评论