yd

Matplotlib log scale tick label number formatting

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: With matplotlib when a log scale is specified for an axis, the default method of labeling that axis is with numbers that are 10 to a power eg. 10^6. Is there an easy way to change all of these labels to be their full numerical representation? eg. 1, 10, 100, etc. Note that I do not know what the range of powers will be and want to support an arbitrary range (negatives included). 回答1: Sure, just change the formatter. For example, if we have this plot: import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.axis([1, 10000, 1, 100000]) ax

#Star Way To Heaven 优化二分 /prim<凉宫春日的忧郁>

为君一笑 提交于 2019-11-27 16:41:09
之前是贪心看不粗来,现在二分也看不粗来了,QAQ。。。 审题清楚,别没看懂题就忙着暴搜,小w不一定走整点,可以走直线 其实,看到 就应该想到二分了 那么其实二分的答案是作为每个点的半径以圆的形式出现的,一个答案是否成立,看这些障碍圆建出来后,是否还能从左到右联通,那其实是看障碍组成的边界线是否能联通上下的边界。并查集,dfs都可维护。然后是T80的好成绩。 考虑优化,每次并查集会枚举所有点判距离(毕竟6000^2开不下),这其中是有冗余状态的,考虑这种情况,a可以和他最近的b相连,b可以和他最近的c相连,a也可以和c相连,这是三点其实只用枚举两次就可以,然而枚举c时就多枚举了。优化就显而易见的只枚举四个方向的最近点。 1 #include<bits/stdc++.h> 2 #define MAXN 6100 3 #define reg register 4 #define INF 1000000000.0 5 using namespace std; 6 inline int read(){ 7 int s=0,w=0;char ch=getchar(); 8 while(ch<'0'||ch>'9')w=(ch=='-'),ch=getchar(); 9 while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar(); 10 return w?