Posts
2017
g++ 编译多个源文件(转载)
参考资料
一. 常用编译命令选项 假设源程序文件名为test.c。
无选项编译链接 用法:#gcc test.c 作用:将test.c预处理、汇编、编译并链接形成可执行文件。这里未指定输出文件,默认输出为a.out。
qt 5.x 学习笔记 (2)
先来放一波过程中用到的资料和官方文档好了。
basic layout_qt5.8
QBoxLayout Class_qt5.8
QString Class 5.8
QChar Class qt 5.8
codeforces #413 C. Fountains (BIT维护前缀max)
题目链接
题意:有2种货币,分别为C和D.给出n种资源的代价和美丽度,每种资源只能用其中一种资源购买。现在拥有货币C的数量是c,拥有货币D的数量是d.然后恰好买2个资源,问最大美丽度,不能的话输出0.
codeforces #413 B T-shirt buying (贪心)
题目链接
题意:有n个T恤,每个价格都不同,有三种颜色,分别用1,2,3表示,每件T恤给出前xiong和后背的颜色。现在有m个顾客排成一队,对于每个顾客,给出他喜欢的颜色,只要一个T恤的前xiong或者后背的颜色之一满足该颜色即可。顾客总希望买符合他喜欢颜色的T恤中价格最低的。现在问每个顾客买到的T恤的价格,如果某个顾客没有买T恤,输出-1
codeforces #413 A. Carrot Cakes (模拟)
题目链接
题意:初始有一个锅,每t分钟可以做好k个饼,现在需要N个饼。还可以另外建一个锅,花费d时间,建好以后两个锅可以并行烙饼。问是否应该建锅?(以期减少烙饼时间)
ubuntu 包管理(apt-get)损坏的解决办法
症状是不管安装什么,都会说有一大堆依赖无法安装。。。
大概是: a depends b[i],but b[i] is not be installed. (b==0..n)
install galliumOS on chromebook with chrx
·2 分钟
我的chromebook 是 samsung 3
查阅Hardware Compatibility 可以知道我的cb支持 gallium,对应的cpu 是Intel Braswell
leetcode162. Find Peak Element (O(lgn)复杂度寻找峰值)
·1 分钟
A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.
The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.
leetcode 152. Maximum Product Subarray (最大连续子序列乘积,dp)
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest product = 6.
leetcode 228. Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.
For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].
题意:把连续的数连续表示
leetcode 209. Minimum Size Subarray Sum (尺取法)
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn’t one, return 0 instead.
leetcode 229. Majority Element II (O(1)空间找出现次数大于n/3的元素)
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.
题意:给你n个数,要求找出出现此处大于n/3的。。。
leetcode 75. Sort Colors
·2 分钟
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.