1. sys模块 sys模块包括了一组非常实用的服务,内含很多函数方法和变量,用来处理Python运行时配置以及资源,从而可以与前当程序之外的系统环境交互 1.1 sys.argv 在外部向程序传递参数 1 2 一般情况下,number为0是这个脚本的名字,1,2…则为命令行下传递的参数 示例(在D ...
分类:
编程语言 时间:
2018-08-10 23:15:37
阅读次数:
188
题解:给一个1e5个点2e5条边,每个边有一个值,让你输出一条从1到n边的路径使得:条数最短的前提下字典序最小。 题解:bfs一次找最短路(因为权值都是1,不用dijkstra),再bfs一次存一下路径,4个月前的代码(忘了为什么搞得那么麻烦),wa了两天,今天看了一下题目,看了一下代码,改了一下初 ...
分类:
其他好文 时间:
2018-08-10 21:29:23
阅读次数:
159
class Solution { public: void getShortestPaths(string cur, string ed, map> &nexts, map &distances, vect... ...
分类:
其他好文 时间:
2018-08-09 12:16:07
阅读次数:
323
#include<bits/stdc++.h>using namespace std;typedef pair<long long,int>clot;priority_queue<clot,vector<clot>,greater<clot> >wash,dry;//升序队列int l,n,m;lo ...
分类:
其他好文 时间:
2018-08-09 01:13:58
阅读次数:
147
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open ...
分类:
其他好文 时间:
2018-08-08 13:43:53
阅读次数:
472
题目链接 "bzoj4456: [Zjoi2016]旅行者" 题解 网格图,对于图分治,每次从中间切垂直于长的那一边, 对于切边上的点做最短路,合并在图两边的答案。 有点卡常 代码 c++ include include include include include include inline ...
分类:
其他好文 时间:
2018-08-07 21:26:44
阅读次数:
153
1002 思路:贪心显然不好贪,直接爆搜。 #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define pii pair<int, int> ...
分类:
其他好文 时间:
2018-08-07 15:04:10
阅读次数:
161
尺取法:顾名思义就是像尺子一样一段一段去取,保存每次的选取区间的左右端点。然后一直推进 解决问题的思路: poj 2566 题意:从数列中找出连续序列,使得和的绝对值与目标数之差最小 思路: 应用尺取法的代码: 解决问题的代码: poj 2739 题意:将一个整数分解为连续的素数之和,有多少种分法? ...
分类:
其他好文 时间:
2018-08-06 14:37:27
阅读次数:
170
题目链接:https://www.nowcoder.com/acm/contest/143/G 题目描述 Give two positive integer c, n. You need to find a pair of integer (a,b) satisfy 1<=a,b<=n and th ...
分类:
其他好文 时间:
2018-08-05 13:05:03
阅读次数:
128
POJ 1410 判断线段交和点在凸包内 1 #include <cstdio> 2 #include <algorithm> 3 #include <cmath> 4 #define MP make_pair 5 using namespace std; 6 typedef long long L ...
分类:
其他好文 时间:
2018-08-05 10:25:06
阅读次数:
173