03 2020 档案

摘要:题解:使用二分搜索,在输出小数问题上,一般都会指定允许的误差范围或者是输出中小数点后面的位数。因此在使用二分搜索法时,有必要设置合理的结束条件来满足精度的要求。 设定循环次数作为终止条件,1次循环可以把区间的范围缩小一半,100次的循环则可以达到10^(-30)的精度范围,基本上是没有问题的,也可以 阅读全文
posted @ 2020-03-30 22:55 SunCY 阅读(125) 评论(0) 推荐(0)
摘要:5.6.1 C++程序的一般组织结构 • 一个源程序可以划分为多个源文件: ▫ 类声明文件(.h文件) ▫ 类实现文件(.cpp文件) ▫ 类的使用文件(main()所在的.cpp文件) • 利用工程来组合各个文件。 当代码量很大的时候,可以通过把类写在一个文件中,只需要在main中直接调用就好了 阅读全文
posted @ 2020-03-26 21:48 SunCY 阅读(474) 评论(0) 推荐(0)
摘要:1标识符的作用域与可见性 ▫ 函数原型作用域 比如 int run(int a) ; 的范围是()括号里面 ▫ 局部作用域(块作用域) int run(int a){ int b; yuju; } //a的作用于是 { }里面,b的作用域是 定义位置 到 } ▫ 类作用域 • 类的成员具有类作用域, 阅读全文
posted @ 2020-03-26 21:23 SunCY 阅读(241) 评论(0) 推荐(0)
摘要:类和对象 类和对象 • 类是具有相同属性和行为的一组对象的集合,它为属于该类的全部对象提供了统一的抽象描述,其内部包括属性和行为两个主要部分。 • 利用类可以实现数据的封装、隐藏、继承与派生。 • 利用类易于编写大型复杂程序,其模块化程度比C中采用函数更高。‘ • 新类型的对象该如何被创建和销毁? 阅读全文
posted @ 2020-03-23 14:47 SunCY 阅读(304) 评论(0) 推荐(0)
摘要:函数的定义与使用: 调用前先声明函数: ▫若函数定义在调用点之前,则无需另外声明; ▫若函数定义在调用点之后,则需要在调用函数前按如下形式声明函数原型: 类型标识符 被调用函数名(含类型说明的形参表); •调用形式 函数名(实参列表) •嵌套调用 ▫在一个函数的函数体中,可以调用另一函数,称为嵌套调 阅读全文
posted @ 2020-03-23 11:43 SunCY 阅读(295) 评论(0) 推荐(0)
摘要:巧妙地预处理 + 扫描线 https://blog.csdn.net/weixin_41380961/article/details/90083696 别人的代码,平台有问题,我没写 https://vjudge.net/problem/UVALive-3905 #include<stdio.h> 阅读全文
posted @ 2020-03-21 20:51 SunCY 阅读(123) 评论(0) 推荐(0)
摘要:结构体+优先队列+贪心 #include <iostream> #include <cstdio> #include <cstring> #include <limits> //#include <stack> #include<queue> #include <algorithm> #define 阅读全文
posted @ 2020-03-21 20:42 SunCY 阅读(99) 评论(0) 推荐(0)
摘要:贪心,有一些点少不留意就会wa #include <iostream> #include <cstdio> #include <cstring> #include <limits> //#include <stack> #include<queue> #include <algorithm> #de 阅读全文
posted @ 2020-03-21 20:40 SunCY 阅读(135) 评论(0) 推荐(0)
摘要:贪心+预处理 有个点 就是写错了,找了半天哇。 R是double类型不是int类型! #include <iostream> #include <cstdio> #include <cstring> #include <limits> #include<cmath> #include <algori 阅读全文
posted @ 2020-03-21 20:10 SunCY 阅读(148) 评论(0) 推荐(0)
摘要:并查集+贪心 https://vjudge.net/contest/362147#problem/C #include <iostream> #include <cstdio> #include <cstring> #include <limits> #include <algorithm> #de 阅读全文
posted @ 2020-03-21 20:01 SunCY 阅读(96) 评论(0) 推荐(0)
摘要:1.控件直接拖到右边就好了。 2.信号模式下,可以定义按钮点击信号与槽的连接 3.还有两个模块 阅读全文
posted @ 2020-03-15 22:16 SunCY 阅读(211) 评论(0) 推荐(0)
摘要:#include <cstdio> #include <iostream> #include <cmath> #include <cstdlib> #include <cstring> #define _for(i,a,b) for(int i= a;i<b;i++) using namespace 阅读全文
posted @ 2020-03-14 23:14 SunCY 阅读(153) 评论(0) 推荐(0)
摘要:并查集 #include<iostream> #include<string.h> #include<algorithm> #include<cmath> #include<map> #include<string> #include<stdio.h> #include<vector> #inclu 阅读全文
posted @ 2020-03-14 23:12 SunCY 阅读(94) 评论(0) 推荐(0)
摘要:注意set的交集和并集的写法 #include<bits/stdc++.h> using namespace std; map< set<int>,int > Map; vector< set<int> > Setcache; stack<int> sta; int ID( set<int> x) 阅读全文
posted @ 2020-03-13 22:24 SunCY 阅读(125) 评论(0) 推荐(0)
摘要:带标记的并查集 ,原来加速后也不见得就很快了 #include<cstdio> #include<iostream> #define endl '\n' #define _for(i,a,b) for(int i=a;i<b;i++) using namespace std; const int N 阅读全文
posted @ 2020-03-13 22:11 SunCY 阅读(284) 评论(0) 推荐(0)
摘要:https://vjudge.net/contest/360957#problem/F 题解 https://blog.csdn.net/niushuai666/article/details/6981689 #include<iostream> #include<cstdio> #include< 阅读全文
posted @ 2020-03-13 20:56 SunCY 阅读(133) 评论(0) 推荐(0)
摘要:https://vjudge.net/contest/360957#problem/E m行n列的一个矩阵 求:每行选一个数,求前n个最小的sum是多少。 思路用优先队列维护前i行的结果,再根据这个遍历求出前i+1行的,以此类推。 #include <iostream> #include <cstd 阅读全文
posted @ 2020-03-13 20:49 SunCY 阅读(101) 评论(0) 推荐(0)
摘要:不能用线段树开4N空间,因为深度并不确定,最差情况肯定爆内存 解决办法就是反过来建树,根节点->右子树->左子树,建树的过程用stack把结果存下来 #include<bits/stdc++.h> #define endl '\n' #define _for(i,a,b) for(int i=a;i 阅读全文
posted @ 2020-03-13 20:26 SunCY 阅读(449) 评论(0) 推荐(0)
摘要:https://vjudge.net/contest/360957#problem/B #include<bits/stdc++.h> #define endl '\n' #define _for(i,a,b) for(int i=a;i<b;i++) using namespace std; co 阅读全文
posted @ 2020-03-13 20:21 SunCY 阅读(141) 评论(0) 推荐(0)
摘要:上代码 import numpy as np import matplotlib.pyplot as plt def f(x): return x*x*x+2*x+1.2**x; def plot_f(): x = np.linspace(1,100,1000) y = f(x) # plt.fig 阅读全文
posted @ 2020-03-12 15:11 SunCY 阅读(645) 评论(0) 推荐(0)
摘要:http://121down.com/soft/softview-27651.html#downaddress 下载,里边有教程 阅读全文
posted @ 2020-03-11 15:00 SunCY 阅读(85) 评论(0) 推荐(0)
摘要:进制转换 package ch2; import java.util.Scanner; public class CG0311_2 { public static void main(String [] args) { Scanner sc = new Scanner(System.in); lon 阅读全文
posted @ 2020-03-11 14:18 SunCY 阅读(402) 评论(0) 推荐(0)
摘要:https://vjudge.net/contest/360957#problem/J #include <bits/stdc++.h> using namespace std; typedef long long ll; struct Matrix{ int m[2][2]; }; Matrix 阅读全文
posted @ 2020-03-10 23:58 SunCY 阅读(100) 评论(0) 推荐(0)
摘要:二叉树的遍历,这个题不能用T[4*N]建树,因为最坏的情况树很深,数组会爆的,2^1000 s所以求后续遍历的话,就反着来 根节点—>右子树—>左子树,然后把结果用stack存起来倒叙输出就好了 // preorder sequence inorder sequence postorder sequ 阅读全文
posted @ 2020-03-10 21:42 SunCY 阅读(140) 评论(0) 推荐(0)
摘要:FBI树,直接套上线段树的模板 #include<bits/stdc++.h> #define endl '\n' #define _for(i,a,b) for(int i=a;i<b;i++) using namespace std; const int N = 1055; typedef lo 阅读全文
posted @ 2020-03-10 20:42 SunCY 阅读(149) 评论(0) 推荐(0)
摘要:先达标找规律吧,达标的时候看奇数的个数而不是偶数的个数,就能和看出来了 这个题我算pow(2,n)的时候又出现了向下取整的情况,所以就是说,以后算2的n次方 直接1ll<<n就完了。 https://codeforces.com/gym/101972/problem/J #include<bits/ 阅读全文
posted @ 2020-03-10 15:56 SunCY 阅读(129) 评论(0) 推荐(0)
摘要:https://codeforces.com/gym/101972/problem/G 求二维的一片区域中的最大最小值。 #include<bits/stdc++.h> #define endl '\n' #define _for(i,a,b) for(int i=a;i<b;i++) using 阅读全文
posted @ 2020-03-10 15:18 SunCY 阅读(196) 评论(0) 推荐(0)
摘要:https://codeforces.com/gym/101972/problem/C https://blog.csdn.net/a1dark/article/details/10679833 #include<bits/stdc++.h> #define endl '\n' #define _f 阅读全文
posted @ 2020-03-10 14:40 SunCY 阅读(187) 评论(0) 推荐(0)
摘要:#include<iostream> #include<vector> #include<algorithm> #include <queue> #include <functional> #define endl '\n' #define _for(i,a,b) for(int i=a;i<b;i 阅读全文
posted @ 2020-03-10 13:18 SunCY 阅读(109) 评论(0) 推荐(0)
摘要:输入方式 a, b, c = map(float, input().split()) alist = list(map(int, input().split())) n = int(input()) #数组 for i in range(n): Y[i] = int( input() ) impor 阅读全文
posted @ 2020-03-09 23:57 SunCY 阅读(402) 评论(0) 推荐(0)
摘要:一,几个问题 1.什么是面向过程的程序设计的特点? 面向过程(Procedure Oriented)是一种以过程为中心的编程思想,面向过程也可称之为面向记录编程思想,他们不支持丰富的面向对象特性(比如继承、多态),并且它们不允许混合持久化状态和域逻辑。就是分析出解决问题所需要的步骤,然后用函数把这些 阅读全文
posted @ 2020-03-09 21:59 SunCY 阅读(236) 评论(0) 推荐(0)
摘要:工具-》编译器选项-》代码-》缺省源-》把 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <string> #include <map> 阅读全文
posted @ 2020-03-07 10:35 SunCY 阅读(1215) 评论(0) 推荐(0)
摘要:先顺便提一下怎么单步调试 设置断点后,点击调试 运行成功后,我们开始选择添加查看, 输入后,最左边那一栏就可以看到程序运行到蓝色那一行时具体的变量值是多少,点击下一步就调到下一行,如果这一句是函数,点击单步进入函数内部。 开始正题: 工具-》编译选项-》代码生成/优化-》连接器-》产生调试信息这一项 阅读全文
posted @ 2020-03-07 10:24 SunCY 阅读(1339) 评论(0) 推荐(0)
摘要:from PyQt5 import QtCore, QtGui, QtWidgets ########################################## import sys, os import datetime import shutil 废了相当长的时间,原来是应该写成 Qt 阅读全文
posted @ 2020-03-06 16:35 SunCY 阅读(4521) 评论(1) 推荐(1)
摘要:之前直接从文件管理器中复制粘贴路径,突然就遇见了报错,原来是路径写法问题\t等写法 直接吧 \ 这个符号,全换成 / 问题就解决了 https://blog.csdn.net/qq_38161040/article/details/88388123 阅读全文
posted @ 2020-03-06 15:16 SunCY 阅读(100) 评论(0) 推荐(0)
摘要:自从昨天装好了SQL,我的Pycharm似乎又变慢了许多。 电脑是好几年前的垃圾主机了,没带笔记本,打开一次Pycharm不容易啊。 晚上想睡会再继续,结果让我爸以为我睡觉了,把电脑关了,给我气哭了就。 后来电脑大概一个半小时的Indexing吧。。。。真服了 现在问题解决了,File->Setti 阅读全文
posted @ 2020-03-06 01:19 SunCY 阅读(3640) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P1546 #include<bits/stdc++.h> #define N 1000 using namespace std; struct node{ int x,y,w; bool const < (node &o){ ret 阅读全文
posted @ 2020-03-05 00:06 SunCY 阅读(159) 评论(0) 推荐(0)
摘要:一个题案例过不了,结果是因为,cout输出科学计数法了。 那么这样写就好了 #include<bits/stdc++.h> #define N 105 #define endl '\n' #define _for(i,a,b) for(int i=a;i<b;i++) using namespace 阅读全文
posted @ 2020-03-04 23:34 SunCY 阅读(260) 评论(0) 推荐(0)
摘要:原来一直用pip install *** 后面好像用豆瓣源会很快或者FQ也会很快 用pycharm装第三方库 打开Pycharm,file—》setting,如图所示 过几分钟就给装好了 如果安装失败: 1.换用国内源 把下面的粘贴进去 https://pypi.tuna.tsinghua.edu. 阅读全文
posted @ 2020-03-02 21:28 SunCY 阅读(228) 评论(0) 推荐(0)
摘要:老师要求做这个作业,但是之前直接用了eclipse,所以就不会,学一下吧 首先要找到有.java文件的目录。这样找。 打开这个IDE的时候,就有文件的工作目录,就是他了。 来给它粘过来,回车 然后在点两下,找到这个.java文件。复制路径我的是 C:\Users\Administrator.XTZJ 阅读全文
posted @ 2020-03-02 20:24 SunCY 阅读(378) 评论(0) 推荐(0)
摘要:2.1 C++的特点和产生 特点: 带类的C语言,更好的C语言,兼容C语言。不是一个纯正面向对象的语言,支持面向对象的方法。 2.2 基础操作 #include <iostream> 通过头文件来调用库功能。 using namespace std; //命名例子,比如说张三,王三,你叫三的时候,需 阅读全文
posted @ 2020-03-02 10:18 SunCY 阅读(129) 评论(0) 推荐(0)