摘要: "A. Two Regular Polygons" 思路: 在一个正n边形的顶点连线,构造出一个正m边形是否可能。 include include include include include include include include include include using namesp 阅读全文
posted @ 2020-03-22 22:54 0x4f 阅读(445) 评论(0) 推荐(0) 编辑
摘要: "41. 包含min函数的栈" 设计一个支持push,pop,top等操作并且可以在O(1)时间内检索出最小元素的堆栈。 push(x)–将元素x插入栈中 pop()–移除栈顶元素 top()–得到栈顶元素 getMin()–得到栈中最小元素 样例 思路: 可以用两个栈,一个是正常的栈,另一个栈存储 阅读全文
posted @ 2020-03-22 15:44 0x4f 阅读(260) 评论(0) 推荐(0) 编辑
摘要: "A. Grade Allocation" n students are taking an exam. The highest possible score at this exam is m. Let ai be the score of the i th student. You have a 阅读全文
posted @ 2020-03-22 15:03 0x4f 阅读(232) 评论(0) 推荐(0) 编辑
摘要: "A. Bad Ugly Numbers" You are given a integer n (n 0). Find any integer s which satisfies these conditions, or report that there are no such numbers: 阅读全文
posted @ 2020-03-22 14:16 0x4f 阅读(347) 评论(0) 推荐(0) 编辑