Time Limit: 10 second Memory Limit: 2 MB 问题描述 新年到了,突然间,就在那美丽的一霎那,你好友和你(K个人)的周围满是礼物,你发扬你帅气的风格,让你的好友先拿,但是每个人只能拿当前离自己最近的礼物[当然如果有并列的多个礼物离你的距离相等(精确到小数后四位,所有运算均为去尾),这些礼物就都属于这个人].现在你们所在的位置是原点(0,0),每个礼物的位置用坐标表示.现在告诉你每个礼物的坐标,还有每个礼物是谁送的.要你找出你的礼物离你多远,你能拿到多少礼物,这…
Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Example: Input: s = "abcd" t = "ab…
Problem Description 作为一个强迫症患者,小 Y 在走游戏里的迷宫时一定要把所有的宝箱收集齐才肯罢休.现在给你一个 N *M 的迷宫,里面有障碍.空地和宝箱,小 Y 在某个起始点,每一步小 Y 可以往上下左右走,当然前提时没有走出迷宫并且走到的点不是障碍.如果小 Y 走到了某个为宝箱的点,那么这个宝箱就被他收集到了,然后此处变为空地. 现在你需要计算小 Y 最少需要走多少步才能收集齐所有的宝箱. Input 输入包含多组数据. 对于每组数据,第一行两个正整数 N;M(1<=N;…
Time Limit: 1000 MS In mathematics, the factorial of a positive integer number n is written as n! and is de ned as follows: n! = 1 2 3 4 : : : (n 1) n = ∏n i=1 i The value of 0! is considered as 1. n! grows very rapidly with the increase…
/** * 找出未出现的最小正整数 * @param A * @param n * @date 2016-10-7 * @author shaobn */ public static int findArrayMex(int[] a,int n){ int count = n; int temp = 0; int dir = 1; int num = 0; for(int i = 0;i<count-1;i++){ if(a[i]>a[i+1]){ temp = a[i]; a[i]= a[i…
http://lightoj.com/volume_showproblem.php?problem=1336 Sigma Function Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1336 Description Sigma function is an interesting function in Number Theor…