假设删除第k位,把整数A表示成如下形式: A = a * 10^(k+1) + b * 10 ^k + c; 则: B = a * 10^k + c; N = A + B = (11*a+b)*10^k + 2*c; 显然: 11*a+b = N / (10^k) 2*c = N % (10^k) 但是c有可能产生进位,产生的影响为: 11*a+b+1 = N/(10^k)[b+1最多为10,不会影响到11*a的值] 2*c = N % (10^k) + 10^k; 把这两种情况分别考虑一下.…
中位数计数 Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 909 Accepted Submission(s): 346 Problem Description 中位数定义为所有值从小到大排序后排在正中间的那个数,如果值有偶数个,通常取最中间的两个数值的平均数作为中位数. 现在有n个数,每个数都是独一无二的,求出每个数在多少个包…
Boring count Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 932 Accepted Submission(s): 382 Problem Description You are given a string S consisting of lowercase letters, and your task is cou…
久しぶり! 发现的一道有意思的题,想了半天都没有找到规律,结果竟然是思路题..(在大佬题解的帮助下) 原题戳>>https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1305<< 有这样一段程序,fun会对整数数组A进行求值,其中Floor表示向下取整: fun(A) sum = 0 for i = 1 to A.length for j = i+1 to A.length …
BestCoder Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1614 Accepted Submission(s): 566 Problem Description Mr Potato is a coder.Mr Potato is the BestCoder. One night, an amazing…