算法分析与设计
条件反射104
中国科学院大学自动化研究所
展开
-
求平面上第K近的点
Problem description: Given NNN points on the plane. Find the KthKthKth closest point to the origin (0,0)(0,0)(0,0). (Here, the distance between two points on a plane is the Euclidean distance.) Input: Line 1: NNN KKK Others: point coordinate Output: Line 1原创 2020-10-20 22:52:00 · 213 阅读 · 0 评论 -
求m^n的后三位数(时间复杂度O(logn))
Problem description: Given two integers m and n, find the integer represented by the last three digits of mnm^nmn. For example, if m=3m=3m=3 and n=9n=9n=9, the returned number should be 683(39=19683)683(3^9=19683)683(39=19683). Please give an algorithm wit原创 2020-10-20 22:43:41 · 520 阅读 · 0 评论