标签:desc als 个数 public ... while number tle cto
题目描述
1 class Solution { 2 public: 3 bool IsContinuous( vector<int> numbers ) { 4 if(numbers.size() != 5) return false; 5 sort(numbers.begin(),numbers.end()); 6 int num_of_zero = 0; 7 //找到0的个数 8 while(num_of_zero < 5 && numbers[num_of_zero] == 0) 9 num_of_zero ++; 10 //看数组正数之间是否有重复数字 11 for(int i = num_of_zero;i < 4;i ++) 12 if(numbers[i] == numbers[i + 1]) return false; 13 return (num_of_zero < 5) && (numbers[4] - numbers[num_of_zero] < 5); 14 } 15 };
标签:desc als 个数 public ... while number tle cto
原文地址:http://www.cnblogs.com/lca1826/p/6526411.html