07 2019 档案
摘要:考试报名系统是对考试报名管理的简单模拟,用菜单选择方式完成下列功能:输入考生信息;输出考生信息;查询考生信息;添加考生信息;修改考生信息;删除考生信息。每条考生信息由准考证号、姓名、性别、年龄、报考类别等信息组成。 要求:定义一个专用的类型 ElemType,用于描述考生信息,数据结构用一个类描述,
阅读全文
摘要:小明初学C++,已明白了四则运算、关系运算、逻辑运算、赋值运算、输入输出、简单选择和循环结构的用法,但他的英语不太好,记不住太多的保留字,于是他利用汉语拼音做保留字,山寨C++,发明了一种表达自己思想的算法描述规则。 规则很简单:他将开始程序头部以一个拼音名字标记,C++程序中的"{,}"用拼音“k
阅读全文
摘要:族谱(或称家谱)是一种以表谱形式,记载一个以血缘关系为主体的家族世系繁衍和重要人物事迹的特殊图书体裁。族谱是中国特有的文化遗产,是中华民族的三大文献(国史,地志,族谱)之一,属珍贵的人文资料,对于历史学、民俗学、人口学、社会学和经济学的深入研究,均有其不可替代的独特功能。本题对族谱管理进行简单的模拟
阅读全文
摘要:主要还是等差公式: 等差数列前n项和: (1) Sn = n*(a1 + an) / 2 (2) 最开始尝试用递归求解, 但是递归爆栈了, 又改用循环.
阅读全文
摘要:#include #include using namespace std; int main() { int n, ah, am, as, bh, bm, bs; int result_s, result_m, result_h; while(cin >> n) { while(n --) { cin >> ah >> am >> as >> bh >> bm >...
阅读全文
摘要:#include #include #include using namespace std; int main() { int n; int a[33][33]; while(scanf("%d", &n) != EOF) { for(int i = 1; i <= n; ++ i) { a[i][1] = 1; } for(int i = 1; i...
阅读全文
摘要:#include #include #include using namespace std; int main() { stack s; int n, m, r; while(cin >> n >> r) { if(n 10) { if(s.top() == 10) cout << 'A'; else if(s.top() == 11) cout ...
阅读全文
摘要:#include #include using namespace std; int main() { int n, len; char s[1010]; cin >> n; getchar(); while(n --) { gets(s); len = strlen(s); ...
阅读全文
摘要:#include #include #include using namespace std; int main() { string s; int n, i, j, len; cin >> n; while(n --) { cin >> s; len = s.length(); bool flag = true; for(i = 0, j = le...
阅读全文
摘要:最小公倍数的求解在最大公约数的基础上运行. 当得到a和b的最大公约数d之后, 可以马上得到a和b最小公倍数是ab / d. 由于ab在实际运算中可能会溢出,因此更恰当的写法是a / d * b.由于d是a的约数,所以a/d一定可以整除.(d是最大公因数)
阅读全文
摘要:#include #include int main() { int n, len; char s[110]; scanf("%d", &n); getchar(); while(n --) { gets(s); len = strlen(s); int a = 0, e = 0, i_ = 0, o = 0, u = 0; for(int i = 0; i ...
阅读全文
摘要:#include #include int main() { char a[110]; int len; while(gets(a)) { len = strlen(a); for(int i = 0; i < len-1; ++ i) { if(i == 0) /...
阅读全文
摘要:#include #include #include using namespace std; int main() { string s; while(cin >> s) { char smax = s[0]; int len = s.length(); for(int i = 1; i smax) { smax = s[i]; } } ...
阅读全文
摘要:#include #include int main() { char a[55]; int n, len; scanf("%d", &n); getchar(); // 吃掉n后面的回车键 while(n --) { gets(a); len = strlen(a); int length = 0; if(a[0] >= '0' && a[0] = '0'...
阅读全文
摘要:在循环中每个学生的sum初始都要清零(第20行代码) Wrong Answer(第20行, 结构体中的sum没有初始化)->Accepted
阅读全文
摘要:Runtime Error 就是ACM中常说的RE,出现这种错误往往是数组越界造成的,你应该检查数组开的是否足够大,或者在程序处理过程中是否存在数组下表越界的情况。
阅读全文
摘要:经常会遇到这种令人抓狂的情况 自己编写的程序在codeblocks上怎么编译运行都能输出正确结果 然而一提交,却无法Accept,很多时候显示的并不是Wrong Answer 而是比WrongAnswer更令人绝望的 。 在oj中,给定的Time Limit 是1000MS,出现Time Limit
阅读全文
摘要:Time Limit Exceeded(没有加!=EOF)->Runtime Error(数组开小了) (ACCESS_VIOLATION)->Accepted
阅读全文
摘要:#include #include #include using namespace std; int salary[6] = {100, 50, 10, 5, 2, 1}; int main() { int n; while(scanf("%d", &n) && n != 0) { int a[n]; int sum = 0; for(int i = 0; i <...
阅读全文
摘要:#include #include #include #include #include using namespace std; int main() { int n; while(scanf("%d", &n) && n != 0) { set s; int a[n], b[n]; for(int i = 0; i ()); for(int i...
阅读全文
摘要:#include #include using namespace std; int main() { int n, m; while(scanf("%d %d", &n, &m) && (n != 0 || m != 0)) { int a[n]; a[0] = m; for(int i = 1; i <= n; ++ i) { scanf("%d",...
阅读全文
摘要:#include int f(int n) { if(n == 0 || n == 1) return 1; if(n == 2) return 2; return f(n - 1) + f(n - 3); } int main() { int n; while(scanf("%d", &n) && n != 0) { printf("%d\n", f(n)); ...
阅读全文
摘要:#include #include #include using namespace std; int main() { int n, len; string str; cin >> n; while(n --) { int num = 0; cin >> str; len = str.length(); for(int i = 0; i = '0' &...
阅读全文
摘要:#include #include using namespace std; int main() { int n; while(scanf("%d", &n) && n != 0) { int a[n], cmin, cmin_index; for(int i = 0; i < n; ++ i) { scanf("%d", &a[i]); } cm...
阅读全文
摘要:#include int main() { int n, m; while(scanf("%d %d", &n, &m) != EOF) { int sum = 0, count = 0; for(int i = 2; i <= 2*n; i += 2) { sum += i; if((i/2) % m == 0) { count ++; ...
阅读全文
摘要:#include #include using namespace std; int main() { int n; while(scanf("%d", &n) != EOF) { double score[n]; double sum = 0; for(int i = 0; i < n; ++ i) { scanf("%lf", &score[i]); ...
阅读全文
摘要:#include long long int memo[33]; long long int f(long long int n) { memo[1] = 1; for(long long int i = 2; i <= n; ++ i) { memo[i] = 2 * (memo[i - 1] + 1); } return memo[n]; } int main() {...
阅读全文
摘要:#include #include bool is_prime(int n) { for(int i = 2; i < sqrt(n); ++ i) if(n % i == 0) return false; return true; } int main() { int x, y, sum; while(scanf("%d %d", &x, &y) && (x...
阅读全文
摘要:#include int main() { int n, m; scanf("%d", &m); while(m --) { scanf("%d", &n); float sum = 0; for(int i = 1; i <= n; ++ i) { if(i % 2 == 0) sum -= 1.0/i; else sum += 1.0/i; }...
阅读全文
摘要:有时候在电脑上写的程序运行成功,但在OJ平台上却会提示Presentation Error。 1.思路是对的,且运行时间符合要求 2.答案和标准结果非常接近,也就是说最可能是因为,在输出结果中,多了或少了不必要的空格或者回车或者其他,总而言之,OJ平台对格式的检查非常严格,所以一定要认真检查程序的输
阅读全文
摘要:本题有两个坑点(对我来说, 哈哈): (1) 取三位数的个位不是用n%100, 而是n%10 (2) 输出格式, 严格按照最后一个数后面没有空格
阅读全文
摘要:#include #include #include using namespace std; int main() { int n; double m; while(scanf("%d", &n) && n != 0) { int a = 0, b = 0, c = 0; while(n --) { scanf("%lf", &m); if(m > 0...
阅读全文
摘要:#include #include #include using namespace std; int main() { int n, a, sum; while(~scanf("%d", &n)) { sum = 1; while(n --) { scanf("%d", &a); if(a % 2 == 1) { sum *= a; ...
阅读全文
摘要:#include #include #include using namespace std; bool is_leap_year(int y) { if((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)) return true; else return false; } int main() { int month[13]...
阅读全文
摘要:第一次遇见case 0 ... 5 这种写法, 这样写使得使用case写代码简化了不少, 0...5只能升序, 不能写成5...0 一定要注意, 不能直接写一个default来处理其他情况, 加入输入负数的话, switch中得到了0, 则会输出E, 所以要在输入是判断输入的数字是否在0~100之间
阅读全文
摘要:#include #include #include #define PI 3.1415927 using namespace std; int main() { double a; while(~scanf("%lf", &a)) { printf("%.2f\n", fabs(a)); } return 0; }
阅读全文
摘要:#include #include #include #define PI 3.1415927 using namespace std; int main() { double r; while(~scanf("%lf", &r)) { printf("%.3f\n", 4.0/3.0*PI*r*r*r); } return 0; }
阅读全文
摘要:#include #include #include using namespace std; int main() { double x1, y1, x2, y2, d; while(~scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2)) { d = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 ...
阅读全文
摘要:#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { char c, a[3]; int i = 0; while(~scanf("%c", &c)) { a[i] =
阅读全文
摘要:# coding = utf-8 from tensorflow.examples.tutorials.mnist import input_data import scipy.misc import os # 读取MNIST数据集, 如果不存在会事先下载 mnist = input_data.read_data_sets('MNIST_data/', one_hot=True) # 把原始...
阅读全文
摘要:from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf # 载入MNIST数据集 mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) sess = tf.InteractiveSession() # 先定义好初...
阅读全文
摘要:import cv2 import numpy as np img = cv2.imread('image0.jpg', 1) cv2.imshow('src', img) imgInfo = img.shape height = imgInfo[0] width = imgInfo[1] matScale = np.float32([[0.5, 0, 0], [0, 0.5, 0]]) ds...
阅读全文
摘要:import cv2 import numpy as np img = cv2.imread('image0.jpg', 1) cv2.imshow('src', img) imgInfo = img.shape height = imgInfo[0] width = imgInfo[1] # src 3 -> dst 3(左上角, 左下角, 右上角) matSrc = np.float32(...
阅读全文
摘要:# 100 -> 200 x # 100 -> 300 y import cv2 img = cv2.imread('image0.jpg', 1) imgInfo = img.shape dst = img[100:200, 100:300] cv2.imshow('image', dst) cv2.waitKey(0)
阅读全文
摘要:import cv2 import numpy as np img = cv2.imread('image0.jpg', 1) cv2.imshow('src', img) imgInfo = img.shape height = imgInfo[0] width = imgInfo[1] # 获取旋转矩阵(旋转的中心点, 旋转的角度, 缩放的系数) matRotate = cv2.getRo...
阅读全文
摘要:import cv2 import numpy as np img = cv2.imread("image0.jpg", 1) cv2.imshow('src', img) imgInfo = img.shape height = imgInfo[0] width = imgInfo[1] deep = imgInfo[2] newImgInfo = (height*2, width, dee...
阅读全文
摘要:import cv2 import numpy as np img = cv2.imread('image0.jpg', 1) cv2.imshow('src', img) imgInfo = img.shape height = imgInfo[0] width = imgInfo[1] matShift = np.float32([[1, 0, 100], [0, 1, 20...
阅读全文
摘要:# 1 load 2 info 3 resize 4 check import cv2 img = cv2.imread(r"D:\PythonCode\neuron\image0.jpg", 1) imgInfo = img.shape # shape (行[height], 列[width]) print(imgInfo) height = imgInfo[0] width = i...
阅读全文
摘要:attributeError: 'NoneType' object has no attribute 'shape' 报错 可能是因为没有设置路径,所以返回的类型是None。 改正的方法是,读取图片时把路径也写上
阅读全文
摘要:OpenCV安装前需要依赖包numpy,所以需要安装numpy pip install numpy 然后就可以利用下面的代码安装OpenCV了。 pip3 install opencv-python
阅读全文
摘要:一、问题: 之前python3.6是安装的pip版本为:pip=9.0.1,我按照提示升级报错,一直装不上pip18.0,于是直接在site-package目录下删掉了pip-9.0.1的文件夹,然后再执行pip安装其他包的时候就会报错,如下图: 二、解决方案:强制重新安装pip3 cmd下,输入如
阅读全文
python 3以上版本使用pickle.load读取文件报UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 6
摘要:原本代码是这样的 修改之后只需要在打开的时候指定编码 作者:频率52HZ 来源:CSDN 原文:https://blog.csdn.net/qq_33144323/article/details/80042273 版权声明:本文为博主原创文章,转载请附上博文链接!
阅读全文
摘要:在利用Anaconda3 + PyCharm 2018 实现神经网络的实践中,涉及到一个根据像素数组绘制图像的实践,如下所示(这里只需要关心image_array即可,对源数据的预处理可忽略): 当运行时,控制台无报错信息,正常执行结束退出(exit code 0),在SciView出处无绘制出的指
阅读全文
摘要:JDK9 引发的血案1、因为使用mysql-connector的依赖版本对应的mysql数据库冲突,mysql8需要使用8.0.11以上的高版本 2、jdk9的反射本身存在BUG,会有warning警告,一般不影响使用,在后续版本会更新修复 首先检查下自己使用的mysql 是什么版本的,5.5 、5
阅读全文
摘要:package dbcp; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; import org.juni...
阅读全文
摘要:package pers.mjn.return_pk; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import org.junit.Test; import pers.mjn.util.JdbcUti...
阅读全文
摘要:package blob; import java.io.FileInputStream; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; import java.sql.Blob; import java.sql.Connection; import java.sql.Pr...
阅读全文
摘要:java.nio.file.AccessDeniedException: C:\2.png at java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source) at java.base/sun.nio.fs.
阅读全文
摘要:问题:caching-sha2-password 处理: ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则 ALTER USER 'root'@'localhost' IDENT
阅读全文
摘要:You are given a m x n 2D grid initialized with these three possible values. Fill each empty room with the distance to its nearest gate. If it is impos
阅读全文
摘要:解法一: 递归 解法二: DFS 解法三: BFS 解法四: 并查集
阅读全文
摘要:解法一: 两重循环, 找到这两个加和为target的数 解法二: 先将数组中所有的数存放到hashmap中, 再遍历该数组, 判断target-当前的数字nums[i]是否已在hashmap中, 若存在, 并且索引值不同, 则返回, 否则, 继续循环
阅读全文
摘要:import cards_tools while True: # 显示功能菜单 cards_tools.show_menu() action_str = input("请选择希望执行的操作: ") print("您选择的操作是[%s]" %action_str) # 1,2,3针对名片的操作 if action_str in ["1","2","3"]: # 新增名片 ...
阅读全文
摘要:存在一个样本数据集,也称作训练样本集,并且样本中每个数据都存在标签,即我们知道样本集中每一数据与所属分类的对应关系,输入没有标签的新数据后,将新数据的每个特征与样本集中的数据对应的特征进行比较,然后算法提取样本集中特征最相似的数据(最近邻)的分类标签。一般来说,我们只选择样本集中前k个最相似的数据,
阅读全文