摘要: #include using namespace std; const double INF = 0xfffff;//无穷大 double min(double a, double b) { return a > b ? b : a; } class Solution { private: int L, N, C, T; int VR, VT1, VT2; ... 阅读全文
posted @ 2019-10-10 22:52 pycodego 阅读(529) 评论(0) 推荐(0) 编辑
摘要: class sort { private int arr[]= {5,7,6,9,8,1,2,3,4,0}; public boolean InsertSort() { for(int i=1;i<arr.length;++i) { for(int j=i;j>0;j--) { if(arr[j-1]>=arr[j]) //前面的比后面的大就交换 { int temp=arr[j-1]; arr[ 阅读全文
posted @ 2019-10-10 15:45 pycodego 阅读(103) 评论(0) 推荐(0) 编辑
摘要: C++不允许在常量对象上调用成员函数,除非成员函数本身也被声明为常量。甚至对不会修改对象的成员函数,也是如此,此外,编译器不允许声明常量的成员函数修改对象; ②对一般情况下,通常修改对象的构造函数和析构函数而言,它们不允许被声明成const,但是他们依然可以用于修改常量对象的初始化; ③对象名列表可以由多个对象名,它们之间用逗号隔开,常量对象在定义的同时初始化,初始化后,再也不能修改它们的数... 阅读全文
posted @ 2019-10-09 22:49 pycodego 阅读(97) 评论(0) 推荐(0) 编辑
摘要: NullPointerException - 空指针引用异常 ClassCastException - 类型强制转换异常。 IllegalArgumentException - 传递非法参数异常。 ArithmeticException - 算术运算异常 ArrayStoreException - 向数组中存放与声明类型不兼容对象异常 IndexOutOfBoundsException - 下标越 阅读全文
posted @ 2019-10-09 13:34 pycodego 阅读(173) 评论(0) 推荐(0) 编辑
摘要: class student { private String name="zhang"; private int num=12; @Override public String toString() { return "名字为:" + name +","+ "学号为:" + num; } } public class Main { ... 阅读全文
posted @ 2019-10-08 22:42 pycodego 阅读(436) 评论(0) 推荐(0) 编辑
摘要: //可以看出我们想调用的是:void fun(int a, int *b);但实际上我们调用的是第二个函数 //而C++11中添加的nullptr就可以解决这个重载问题,减少很多不必要的BUG,编译环境允许的话,还是多多使用nullptr吧。 阅读全文
posted @ 2019-10-08 21:40 pycodego 阅读(494) 评论(0) 推荐(0) 编辑
摘要: package bfs; class Solution{ private boolean used[][]; private int dir[][]=new int[][] {{-1,0},{0,-1},{1,0},{0,1}}; public boolean isCheckMove(String[] map,int x,int y) { return x>=0&&x<map.length&&y> 阅读全文
posted @ 2019-10-08 13:24 pycodego 阅读(451) 评论(0) 推荐(0) 编辑
摘要: Java的正则表达式的书写方式:private String reg="\\d+@\\w*\\.\\w{3}";//正则表达式 //"\\d"表示0-9的一个数字"+"表示前缀\\d有1个或者多个 //"\\."表示正则表达式中的."\\w"表示a-zA-Z0-9字符或者数字 //"{3}"表示有三 阅读全文
posted @ 2019-10-07 19:12 pycodego 阅读(366) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <ctime> #include <vector> #include <algorithm> using namespace std; //int perm() { // int data[4] = { 5,2,1,4 }; // sort(data, data + 4); // do { // for (int i = 0; i < 4; 阅读全文
posted @ 2019-10-07 17:39 pycodego 阅读(222) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <vector> #include <string> using namespace std; class Solution { private: int dir[4][2] = { {-1,0},{0,-1},{1,0},{0,1} }; vector<vector<bool>>used; public: bool isCheckMove 阅读全文
posted @ 2019-10-07 17:38 pycodego 阅读(278) 评论(0) 推荐(0) 编辑