SquareTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 12229 Accepted: 4223DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square?InputThe first line of input contains N, the number of
The Sierpinski FractalTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2684 Accepted: 1240DescriptionConsider a regular triangular area, divide it into four equal triangles of half height and remove the one in the middle. Apply the same
OulipoTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6114 Accepted: 2329DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from
LinearityTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 5999 Accepted: 1287DescriptionAlice often examines star maps where stars are represented by points in a plane and there is a Cartesian coordinate for each star. Let the Linearity of
前幾天自己想出了利用歸併排序求逆序數的方法,找了一個求逆序數的題2299 交了300++MS水過... Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 19686 Accepted: 6959DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes
Children of the Candy CornTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4046 Accepted: 1838DescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies,
題目: 有一字串由M個單片語成單詞之間有空格隔開(只有空格,沒有其他標點符號),有N個關鍵字,現在要在字串中找出包含N個關鍵字(每個關鍵字至少出現一次,沒有說要不要按什麼順序)的最短子串。函數原型:String extractSummary(String description, String[] keywords) 思路: 想了一陣,想出了一個方法,設主串長n 關鍵字長m 則複雜度大致為nlogm舉個例子說下過程:例如主串: ab ba ad ba ab ef ba ab
Constructing RoadsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 12166 Accepted: 4831DescriptionThere are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other.
Bad CowtractorsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6456 Accepted: 2816DescriptionBessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns that are conveniently numbered 1..N.
RelativesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6232 Accepted: 2786DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no