非本题意描述做法『但能AC,说明题目样例有问题/题目本身描述不清晰』
(1)高中数列求和
class Solution {
public:
/**
* return the min number
* @param arr int整型vector the array
* @return int整型
*/
int minNumberdisappered(vector<int>& arr) {
// write code here
long long IndexSum=0;
long long TrueSum=0;
int i=1;
for( auto num : arr )
{
IndexSum+=(long long )i;
if( num>0 )
{
TrueSum+=(long long)num;
}
++i;
}
int ret=IndexSum-TrueSum;
if( 0==ret )
{
return i;
}
return ret;
}
}; (2)位运算技巧
- 略,其他牛油有写过

京公网安备 11010502036488号