Tourist's Notes CodeForces - 538C (贪心)】的更多相关文章

A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meaning that t…
C. Tourist's Notes Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/C Description A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level…
C. Tourist's Notes   time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above th…
C. Tourist's Notes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the…
http://codeforces.com/problemset/problem/893/D 题意 Recenlty Luba有一张信用卡可用,一开始金额为0,每天早上可以去充任意数量的钱.到了晚上,银行会对信用卡进行一次操作,操作有三种操作. 1.如果a[i]>0,银行会给卡充入a[i]元. 2.如果a[i]<0 银行从卡中扣除a[i]元. 3.如果a[i]=0 银行会查询卡里的金额. 有两条规则,如果违背信用卡就会被冻结. 1.信用卡里的金额不能大于d. 2.当银行查询卡里的金额时,金额不…
There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebo…
Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n nodes connected with minimum possible number of wires into one network (a wire directly connects two nodes). Exactly k of t…
题目链接:http://codeforces.com/problemset/problem/93/B B. End of Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Students love to celebrate their holidays. Especially if the holiday is th…
C - Ordering Pizza CodeForces - 867C C - Ordering Pizza 这个是最难的,一个贪心,很经典,但是我不会,早训结束看了题解才知道怎么贪心的. 这个是先假设每个人都可以吃到他喜欢的,就是先求出答案,然后按照b-a 排序,分别放入两个优先队列里面, 如果b>a 那就吃第二块,否则就吃第一块,求出num,注意优先队列按照从小到达排序. num1记录第一块吃的数量,num2记录第二块吃的数量. num1%=s,num2%=s  如果num1+num2的数…
题目:http://codeforces.com/contest/570/problem/C 题意:给你一个字符串,由‘.’和小写字母组成.把两个相邻的‘.’替换成一个‘.’,算一次变换.现在给你一些个操作,操作内容是把某个位置的字符变成给定的 字符,求出每次操作后,需要多少次 变换才能把原串所有相邻的‘.’变成一个‘.’.注意,每次操作是累加的,即一次操作就会把原串替换一个字符. 分析:先求出原串的变换次数sum,然后每次询问的时候,直接看他的两边是否是".",如果是".&…