摘要:
Problem:度度熊为了拯救可爱的公主,于是与邪恶大魔王战斗起来。 邪恶大魔王的麾下有n个怪兽,每个怪兽有a[i]的生命值,以及b[i]的防御力。 度度熊一共拥有m种攻击方式,第i种攻击方式,需要消耗k[i]的晶石,造成p[i]点伤害。 当然,如果度度熊使用第i个技能打在第j个怪兽上面的话,会使得第j个怪兽的生命值减少p[i]-b[j],当然如果伤害小于防御,那么攻击就不会奏效。 如果怪... 阅读全文
摘要:
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
摘要:
There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re 阅读全文
摘要:
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou 阅读全文
摘要:
题目如图,关于这道题的第一问比较简单,只需验证式子两边是否相等即可。这里主要做一下第二问。 此题要求找出多个连续正整数,使其立方和恰好等于另一个正整数的立方,因为并没有明确给出相应的条件,比如起始项,项数等,所以找出所有结果并不现实。故将起始项a范围定位1~1000,项数n<=1000。 具体的实现 阅读全文