LeetCode 0121. Best Time to Buy and Sell Stock买卖股票的最佳时机【Easy】【Python】【贪心】 Problem "LeetCode" Say you have an array for which the i th element is the p ...
分类:
编程语言 时间:
2020-02-19 23:55:42
阅读次数:
125
题目1 121. 买卖股票的最佳时机I: 链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/ 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 如果你最多只允许完成一笔交易(即买入和卖出一支股票), ...
分类:
其他好文 时间:
2020-02-19 05:45:29
阅读次数:
89
有N个人排队,每一个人都有一个val来对应,每一个后来人都会插入当前队伍的某一个位置pos。要求把队伍最后的状态输出。 倒序插入,线段树单点更新,从头到尾输出线段树的状态 #include<cstdio> #include<algorithm> #include<cstring> using nam ...
分类:
其他好文 时间:
2020-02-17 19:51:39
阅读次数:
77
题目:https://pintia.cn/problem sets/994805342720868352/problems/994805374509498368 1092 To Buy or Not to Buy (20分) Eva would like to make a string of be ...
分类:
其他好文 时间:
2020-02-09 14:57:03
阅读次数:
54
Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of b ...
分类:
其他好文 时间:
2020-02-09 00:38:57
阅读次数:
93
题目链接:https://codeforces.com/contest/732 A Buy a Shovel 题意:有无穷枚10元硬币和1枚r元硬币,且r是[1,9]。每个物品的单价是x元,求最少买多少件不用找钱。 题解:记得区分用r元和不用r元两种情况,分别对应模10的余数为r或者为0。现在枚举不 ...
分类:
其他好文 时间:
2020-02-09 00:26:47
阅读次数:
94
一 、什么是股票? 维基百科的定义: 股票 (英语:stock)或是 资本存货 (英语:capital stock)是一种有价证券, "股份公司" 将其所有权借由这种有价证卷进行分配 "[1\]" 。因为股份公司需要筹集资金,因此将股票发给投资者作为公司资本部分所有权的凭证,成为股东以此获得股息(股 ...
分类:
其他好文 时间:
2020-02-08 20:51:24
阅读次数:
110
ylbtech-汉语-成语-见笑大方:百科 见笑大方,汉语成语,拼音是jiàn xiào dà fāng,意思是被见识广博的人所笑话。也指让内行人笑话 。出自《庄子·秋水》。 1.返回顶部 1、 中文名:见笑大方外文名:make a laughing stock of oneself before ...
分类:
其他好文 时间:
2020-02-08 09:43:53
阅读次数:
86
"题目" 题意:给你一个数组代表每天的股价。你有k次买入和卖出的机会,问你最多能赚多少钱。买入之前必须卖出已有股份。同一天是可以先买,再卖,或者先卖再买的。 题解:题目没有说数据范围,但是经过我实际测试 k 最大为10^8 ,n最大为10^4。当然k最多只需要取n/2就好了,因为当天买当天卖是没有意 ...
分类:
其他好文 时间:
2020-02-04 14:15:49
阅读次数:
73
#include <string.h> #include <iostream> using namespace std; int main() { char sell[1005],want[1005]; int s[1005]={0}; int j,n=0; cin>>sell>>want; for ...
分类:
其他好文 时间:
2020-02-02 14:05:08
阅读次数:
58