URAL 1605 – Devil’s Sequence [打表规律+高精度小数]


Link 传送门 Problem Robodevil likes to do some mathematics between rehearsals of his orchestra. Today he invented devilish sequence No. 1729: x0 = 0, x1 = 1, xn = (xn − 1 + xn − 2) / 2. For example, x10 = 0.666015625. Robodevil became interested...

URAL 1605 – Devil’s Sequence [打表规律+高精度小数]

Link 传送门 Problem Robodevil likes to do some mathematics between rehearsals of his orchestra. Today he invented devilish sequence No. 1729: x0 =...
阅读全文 0

Python脚本实现调节Ubuntu/LinuxMint屏幕亮度+色温


Linux下可能由于驱动支持不太好,笔记本键盘上的Fn+亮度调节不管用。网上搜资料得知亮度调节的文件位置。 在windows下有调节色温的软件f.lux,能在夜间自动把色温调暖。在Linux下也有个软件叫做redshift,安装好之后可以shell里操作。 这样我们把两个功能做成Python...

Python脚本实现调节Ubuntu/LinuxMint屏幕亮度+色温

Linux下可能由于驱动支持不太好,笔记本键盘上的Fn+亮度调节不管用。网上搜资料得知亮度调节的文件位置。 在windows下有调节色温的软件f.lux,能在夜间自动把...
阅读全文 0

Python解决最小二乘法拟合并绘制散点图


问题背景 最近物理老师让用Excel弄一个最小二乘法拟合然后弄出方程来求玻尔兹曼常数。无奈发现Linux上的WPS没有绘图功能无语啊O__O”…,据说绘图功能是用delphi写的,不好做跨平台移植……那只好将重任加在Python上喽~ 原始数据 u1 = np.array([0....

Python解决最小二乘法拟合并绘制散点图

问题背景 最近物理老师让用Excel弄一个最小二乘法拟合然后弄出方程来求玻尔兹曼常数。无奈发现Linux上的WPS没有绘图功能无语啊O__O”…,据说绘图功能是...
阅读全文 0

CodeForces 66C – Petya and File System


点击打开Codeforces题目链接 题意 给你一些文件的路径,让你找出包含子文件夹最多的文件夹,和子文件最多的文件夹,其中子文件夹和子文件可以是递归意义上的。硬盘符不算文件夹 分析 Python大法好,处理字符串就是爽。统计文件和文件夹即可,包含数量最多的文件夹一...

CodeForces 66C – Petya and File System

点击打开Codeforces题目链接 题意 给你一些文件的路径,让你找出包含子文件夹最多的文件夹,和子文件最多的文件夹,其中子文件夹和子文件可以是递归意义上的...
阅读全文 0

HDU 5351 – MZL’s Border [找规律]


Problem Description As is known to all, MZL is an extraordinarily lovely girl. One day, MZL was playing with her favorite data structure, strings. MZL is really like Fibonacci Sequence, so she defines Fibonacci Strings in the similar way. The defi...

HDU 5351 – MZL’s Border [找规律]

Problem Description As is known to all, MZL is an extraordinarily lovely girl. One day, MZL was playing with her favorite data structure, strings. ...
阅读全文 0

LeetCode #14 – Longest Common Prefix


链接:https://leetcode.com/problems/longest-common-prefix/ 题目:Write a function to find the longest common prefix string amongst an array of strings. 题意:给定一些字符串,找出最常公共前缀 分析:直接暴力做就可以,最常前缀的长度不长于最短的字符串...

LeetCode #14 – Longest Common Prefix

链接:https://leetcode.com/problems/longest-common-prefix/ 题目:Write a function to find the longest common prefix string amongst an array of stri...
阅读全文 0

LeetCode #13 – Roman to Integer


LeetCode题目链接 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题意:给定一个罗马数字字符串,将他转化为阿拉伯整数。 class Solution: def romanToInt(self, s): dict = {'I':...

LeetCode #13 – Roman to Integer

LeetCode题目链接 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题意:给定一个罗马数字...
阅读全文 0

LeetCode #12 – Integer to Roman


LeetCode题目链接 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题意:给定阿拉伯数字,转化为罗马数字 打表记录可能出现的罗马数字,从高位开始处理。 class Solution: def intToRoman(s...
LeetCode题目链接 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题意:给定阿拉伯数字,转化为罗马数字 打表记录可能出...

LeetCode #12 – Integer to Roman

LeetCode题目链接 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题意:给定阿拉伯数字,...
阅读全文 0

LeetCode #11 – Container With Most Water


LeetCode题目链接 Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with...

LeetCode #11 – Container With Most Water

LeetCode题目链接 Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn...
阅读全文 0

LeetCode #9 – Palindrome Number


LeetCode题目链接 Determine whether an integer is a palindrome. Do this without extra space. Some hints:Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, note the restriction of using extra sp...

LeetCode #9 – Palindrome Number

LeetCode题目链接 Determine whether an integer is a palindrome. Do this without extra space. Some hints:Could negative integers be palindromes? (ie,...
阅读全文 0