temp

Floyd算法(针对河大版教材错误修改)

旧巷老猫 提交于 2019-12-13 06:45:42
教材上Floyd算法最后打印出来的结果有点小问题 一开始着重于路径 path数组进行调整,先是调用n次Dijkstra算法 得到路径path 然后尝试调整Floyd算法中path数组。 浏览了网上其他的Floyd算法后,觉得问题不是在path数组上,而是在路径打印问题上,然后对路径打印做了些调整。 因本人能力有限,调整后的程序 也可能会有些许问题,恳请读者批评指正。 测试图 与数据 详见课本 # include <stdio.h> # include <stdlib.h> # define MaxVerNum 10 # define Infinity 1000 typedef struct { char vertex [ MaxVerNum ] ; int edges [ MaxVerNum ] [ MaxVerNum ] ; int vertex_num ; int edge_num ; } MGraph ; void Create_MG ( MGraph * G ) { int i , j , k , weight ; printf ( "Please input the vertex_num and edge_num\n" ) ; scanf ( "%d %d" , & ( G -> vertex_num ) , & ( G -> edge_num ) ) ; for ( i

Max date won't work, alternative?

你。 提交于 2019-12-13 03:39:44
问题 I read through some of the answers but couldn't find the right answer for the following question. I have the below query that runs: SELECT mbr_src_code as 'C', cst_recno as 'ID', ind_first_name as 'FN', ind_last_name as 'LN', cst_org_name_dn as 'Company', cst_ixo_title_dn as 'Title', MAX(inv_trx_date) as 'Latest Transaction', inv_add_user as 'User', pyd_type as 'Type', bat_code as 'Code', mbr_add_user 'Add User', mbr_rejoin_date as 'rejoin', mbt_code, adr_state as 'state', adr_country as

[python]L1-034 点赞 (20分)

守給你的承諾、 提交于 2019-12-13 00:40:22
L1-034 点赞 (20分) 微博上有个“点赞”功能,你可以为你喜欢的博文点个赞表示支持。每篇博文都有一些刻画其特性的标签,而你点赞的博文的类型,也间接刻画了你的特性。本题就要求你写个程序,通过统计一个人点赞的纪录,分析这个人的特性。 输入格式: 输入在第一行给出一个正整数N(≤1000),是该用户点赞的博文数量。随后N行,每行给出一篇被其点赞的博文的特性描述,格式为“K F​1​​⋯F​K​​”,其中1≤K≤10,F​i​​(i=1,⋯,K)是特性标签的编号,我们将所有特性标签从1到1000编号。数字间以空格分隔。 输出格式: 统计所有被点赞的博文中最常出现的那个特性标签,在一行中输出它的编号和出现次数,数字间隔1个空格。如果有并列,则输出编号最大的那个。 输入样例: 4 3 889 233 2 5 100 3 233 2 73 4 3 73 889 2 2 233 123 输出样例: 233 3 n = int(input()) dic = {} for i in range(n): temp = input().split() for j in temp[1:]: if j in dic: dic[j] = dic[j] + 1 else: dic[j] = 1 k = max(dic.values()) temp = [] for key, value in dic

AWS Lambda No Space Left on Device error

点点圈 提交于 2019-12-12 16:07:23
问题 I am using API gateway to call lambda function that imports a mpeg file (10 mb) from s3 and saves in /tmp folder of lambda and the lambda uploads it to external API (youtube etc) Recently the API gateway call to lambda is failing intermittently with error [Errno 28] No space left on device Here is how i am downloading the file urllib.urlretrieve (s3_mpeg_url, '/tmp/{}'.format(mpeg_filename)) If i create a new version of that same lambda function and assign to alias API gateway pointing to ,

How to open a file without saving it to disk

蓝咒 提交于 2019-12-12 12:12:47
问题 My Question: How do I open a file (in the system default [external] program for the file) without saving the file to disk? My Situation: I have files in my resources and I want to display those without saving them to disk first. For example, I have an xml file and I want to open it on the user's machine in the default program for reading xml file without saving it to the disk first. What I have been doing: So far I have just saved the file to a temporary location, but I have no way of knowing

CCF201909-2 小明种苹果(续)(java)

一世执手 提交于 2019-12-12 10:40:02
问题链接 : CCF201909-2 小明种苹果(续) 提交结果 :(在超时的边缘……) 注意:若 第44-45 行条件为badtreeorder[i-2] == badtreeorder[i-1] && badtreeorder[i-1] == badtreeorder[i] ,若为若条件设为badtreeorder[i] == badtreeorder[i+1]&& badtreeorder[i+1] == badtreeorder[i+2] 将出错。 java代码 : import java.util.Scanner; /** * Main.注意考虑到边界情况与特殊情况 * @author : cxc **/ public class Main { //超时如何处理?循环展开,减少分支语句 public static void main(String[] args) { Scanner myin = new Scanner(System.in,"utf-8"); int N = myin.nextInt(); int sum = 0;//剩下所有果子 //中间变量 int[] expectnum = new int[N]; int[] realnum = new int[N]; int badtreenum = 0;//掉落苹果树的数量 int threetreenum =

Java Socket编程

隐身守侯 提交于 2019-12-12 05:01:03
Java Socket编程 对于Java Socket编程而言,有两个概念,一个是ServerSocket,一个是Socket。服务端和客户端之间通过Socket建立连接,之后它们就可以进行通信了。首先ServerSocket将在服务端监听某个端口,当发现客户端有Socket来试图连接它时,它会accept该Socket的连接请求,同时在服务端建立一个对应的Socket与之进行通信。这样就有两个Socket了,客户端和服务端各一个。 对于Socket之间的通信其实很简单,服务端往Socket的输出流里面写东西,客户端就可以通过Socket的输入流读取对应的内容。Socket与Socket之间是双向连通的,所以客户端也可以往对应的Socket输出流里面写东西,然后服务端对应的Socket的输入流就可以读出对应的内容。下面来看一些服务端与客户端通信的例子: 1、客户端写服务端读 服务端代码 1 public class Server { public static void main(String args[]) throws IOException { //为了简单起见,所有的异常信息都往外抛 int port = 8899; //定义一个ServerSocket监听在端口8899上 ServerSocket server = new ServerSocket(port); /

leet189旋转数组

六眼飞鱼酱① 提交于 2019-12-12 04:07:19
暴力法。这个方法我也想到了,就是实现了很长时间 public static void rotate ( int [ ] nums, int k ) { //114ms int privious,temp ; for ( int i = 0 ; i < k ; i++ ) { privious = nums [ nums.length-1 ] ; for ( int j = 0 ; j < nums.length ; j++ ) { temp = nums [ j ] ; nums [ j ] = privious ; privious = temp ; } } for ( int i = 0 ; i < nums.length ; i++ ) { System.out.println ( nums [ i ] ) ; } } 使用额外数组,不过和题意不符合,也算是一个方法 public static void rotate ( int [ ] nums, int k ) { //1ms int [ ] a = new int [ nums.length ] ; for ( int i = 0 ; i < nums.length ; i++ ) { a [ ( i + k ) % nums.length ] = nums [ i ] ; } for ( int i = 0 ; i <

Deleting temp files automatically (C#)

梦想的初衷 提交于 2019-12-12 02:08:31
问题 I have a scenario where I download files from a storage to the temp folder. Then I call a framework to process the file and this framework needs the file during the lifetime of the application. When the applications exits I close all files but when the application crashs the file does not get deleted. There can be multiple instances of the application. What is the best way to get these files deleted? I have 2 ideas: It is okay to delete the files on the next run of the application. My idea is

插入排序代码分析

南楼画角 提交于 2019-12-12 00:30:37
直接插入排序 JavaScript 实现代码: 123456789101112131415161718192021222324 function insertionSort(array) { //自定义函数,交换i和j的位置 function swap(array, i, j) { var temp = array[i]; array[i] = array[j]; array[j] = temp; } var length = array.length, i,//从第二项开始,与前一项作比较 j;//为了往前进行比较 for (i = 1; i < length; i++) { for (j = i; j > 0; j--) { //从第j项开始,与前一项比较大小,如果前项大于后项,则交换位置;如果前项小于等于后项,说明当前排序完成,跳出当前循环,i++进行下一项比较,直到最后一项。 if (array[j - 1] > array[j]) { swap(array, j - 1, j); } else { break; } } } return array; } 直接插入排序 JavaScript 实现代码,减少交换次数: 123456789101112131415161718 function insertionSort(array) { var length = array