数列 0,30,60,90,120、150,180,210,240,270,300,330,360,15,45,75,115
static std::vector<int> generateSequence(int length) {
std::vector<int> sequence;
int increment = 30;
int currentValue = 0;
for (int i = 0; i < length; ++i) {
sequence.push采用back(currentValue);
currentValue += increment;
if (currentValue >= 360) {
currentValue = increment / 2;
increment /= 2;
if (increment == 0) break; // Prevent division by zero; in practice, refinement is needed
}
}
return sequence;
}
页:
[1]