01 FileInputStream and FileOutputStream public static void main(String[] args) throws IOException { //输入流 FileInputStream f = new FileInputStream("D:\\Fiel\\p.txt"); //输出流 FileOutputStream fi = new FileOutputStream("D:\\2.3\
冒泡排序 基本思想: 比较相邻的元素。如果第一个比第二个大,就交换他们两个。 对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对。在这一点,最后的元素应该会是最大的数。 针对所有的元素重复以上的步骤,除了最后一个。持续每次对越来越少的元素重复上面的步骤,直到没
函数(三) 递归 递归的经典应用 二分法 my_list = list(range(10000)) def serach_num(the_list, the_num): if not the_list: print('不在这个区间内') return False flag_length = len(the_list) // 2 if the_num > the_list[flag_length]: s
$data = array('15', '1', '9', '11');数字数组$len = count($data);数组长度for($k=1;$k<$len;$k++)//假设最后一个数字最小,它要'换位置'到第一个数字所需要的次数{ for($j=0;$j<$len-$k;$j++){//从第一个数字开始循环,由于最大的数字一定会被排到最後面,所以小于$len-$k
mycode 没有通过,其实只需要把temp.append改为temp+[nums[i]]即可 def permute(nums): def dfs(res,nums,temp): print(nums,temp) if temp: if len(temp) == numslen: res.append(temp) for i in range(n
数据结构之链表(LinkedList)(一) 双链表 上一篇讲述了单链表是通过next 指向下一个节点,那么双链表就是指不止可以顺序指向下一个节点,还可以通过prior域逆序指向上一个节点 示意图: 那么怎么来实现双链表的增删改查操作呢。 分析: 1) 遍历 方和 单链表一样,只是可以向前,也可以向后查
--创建两个数据库的文件(monitor.dbf 和monitor_temp.dbf 两个文件)CREATE TABLESPACE monitor LOGGING DATAFILE 'C:\install\DB\oracle\app\oracle\oradata\xe\monitor.dbf' SIZE 100M AUTOEXTEND ON NEXT 32M MAXSIZE 1000M EXTENT MANAGEMENT LOCAL; create temporary
/** * 递归转化树形菜单 */ private List<Map<String, Object>> getMenuTree(List<Authorities> authorities, Integer parentId) { List<Map<String, Object>> list = new ArrayList<>(); for (int i = 0; i < authorities.size(); i++
time和date两个函数在Lua中实现所有的时钟查询功能。函数time在没有参数时返回当前时钟的数值。 t=os.date()print(t) 05/07/19 16:49:18 -----------------------------curtime=os.time()temp = os.date("%x", curtime)print(temp) 05/07/19--------------------------------urtim
1 说明 This feature expands the number of read-only applications that can be off-loaded from production databases to an Active Data Guard standby database. Even though an Active Data Guard standby database is open in read-only mode, reporting applicat
时空限制 1000ms/128MB 题目背景 此处省略maxint+1个数 题目描述 在以后的若干天里戴维将学习美元与德国马克的汇率。编写程序帮助戴维何时应买或卖马克或美元,使他从100美元开始,最后能获得最高可能的价值。 输入输出格式 输入格式: 输入文件的第一行是一个自然数N,1≤N≤10
LeetCode86 分割链表题目思路 题目 给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前。 你应当保留两个分区中每个节点的初始相对位置。 输入: head = 1->4->3->2->5->2, x = 3 输出: 1->2->2->4->3->5 思路 这个题目,先开始是我
题目:汇总常见排序算法 一、冒泡排序法 核心思想:冒泡排序只会操作相邻的两个数据。每次冒泡操作都会对相邻的两个元素进行比较,看是否满足大小关系要求。如果不满足就让它俩互换。一次冒泡会让至少一个元素移动到它应该在的位置,重复 n 次,就完成了 n 个数据的排序工作。 // 冒泡
刚学OI的时候觉得难得要死。现在看…… 因为我们不知道谁是罪犯和今天是星期几,所以我们全都枚举一下,然后判定答案。 这样思路是不是就很显然了? 先处理下证词那些字符串。然后对每个答案进行判定。判定出说谎人数不符合或又说真话又说假话等情况,就直接判false。 然后对于每一个人,只
/** * 查询指定时间范围内的所有日期,月份,季度,年份 * * @param $startDate 指定开始时间,Y-m-d格式 * @param $endDate 指定结束时间,Y-m-d格式 * @param $type 类型,day 天,month 月份,quarter 季度,year 年份 * @return array */function getDateByInterval($startDate
题目:给定n个整数,k以及target,在这n个数里找k个数,使得这k个数的和等于target,输出所有可能的方案。 解法:若k为偶数,则先对n个整数排序,然后求出每k/2个数的和(如在4sum问题中求出每两个数的和)存在HashMap中(key:两数和 value:求和的两个数的数组下标的集合),遍历Hashmap,若对于当前元素x存在t
#include<iostream> #include<cstdlib> using namespace std; const int maxsize=105; struct sqlist{ int size; int sq[maxsize]; }; void swap(sqlist *L,int i,int j){ int temp = L->sq[i]; L->sq[i] = L->sq[j]; L->sq[j] = temp; } voi
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { // int a[2][3]={ // {1,2,3}, // {4,5,6} // }; // int a[2][3]={1,2,3,4,5,6}; // //打印单个元素 // printf("%d",a[1][1]); // //元素没赋全,默觉
就是归并排序,只是在排序过程中加入count public class Solution { public int InversePairs(int [] array) { if(array.length==0){ return 0; } int count=0; int[] temp=new int[array.length]; for(int i=0;i<arr
题目:输入3个数a,b,c,按大小顺序输出。 思路: 根据最简单的, 经典的C语言算法, 两两相互交换得到他们的顺序 public class 第三十四题abc三个数大小排序 { public static void main(String[] args) { Integer a = new Integer(10); Integer b = new Integer(6);
题目链接:http://codeforces.com/problemset/problem/580/A AC代码: #include <iostream> #include <cstdio> using namespace std; const int maxn = 100005; int arr[maxn]; int n; int main() { while(scanf("%d",&n) != EOF) { int m
进入>sqlplus /nolog >connnect / as sysdba >startup 1.关闭数据库 SQL>shutdown immediate; 2.删除临时数据文件,模拟媒体失败 3.启动数据库,检查到文件错误 4.脱机该数据文件。 SQL>alter database datafile '文件路径' offline frop; 5.
#include <iostream> using namespace std; bool ALLisNum(string str); bool myatoi(string str,int &num); class RecurveArray { public: int Maxsize; int *Elements;//数组类声明 int CurrentSize; RecurveArray(int Size = 10): Maxsize(Size
1.nginx安装环境 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境。 1.gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc: yum install gcc-c++ 检测是否安装:
1、枚举 1 #include <stdio.h> 2 3 int main() 4 { 5 int a, b; 6 int min; 7 8 scanf_s("%d %d", &a, &b); 9 if (a < b)10 {11 min = a;12 }13 else14 {15 min = b;16 }17 18 int