1,每个小孩的糖果数量是多少 有p个小孩,c个糖果,刚开始第1个小孩发一个糖果,第2个小孩发两个糖果,第p个小孩发p个糖果,如果糖果没有发完,就接着[注意]第1个小孩发p+1个糖果.....第p个小孩发2*p个糖果,如果糖果还没有发完,就继续下一轮,第1个小孩发2*p+1个糖果,... 方法一,遍历[这种方法太low了就折叠一下] package com.cnblogs.mufasa.Main1; import java.util.Scanner; public class Main { pub…
Smallest Minimum Cut Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1181 Accepted Submission(s): 473 Problem Description Consider a network G=(V,E) with source s and sink t. An s-t cut is a…
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordinates don't matter and hence the x-coordinates of s…
[题目]:给定数组arr,arr中所有的值都为正数且不重复.每个值代表一种面值的货币,每种面值的货币仅可以使用一张,再给定一个整数aim代表要找的钱数,求组成aim的最少货币数. [代码1]:时间与额外空间复杂度O(N*aim) import numpy as np from xmlrpc.client import MAXINT def mincoin(arr,aim): if len(arr)<0: print("No coin provided for change!")…
[题目]给定数组arr,arr中所有的值都为正数且不重复.每个值代表一种面值的货币,每种面值的货币可以使用任意张,再给定一个整数aim代表要找的钱数,求组成aim的最少货币数. [代码1]:时间与额外空间复杂度O(N*aim) import numpy as np from xmlrpc.client import MAXINT def mincoin(arr,aim): if len(arr)<0: print("No coin provided for change!") a…
Q1: 回文字符串的分割 Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s. For example, given s = "aab", Return [ ["aa","b"], ["a","a…