If you able to modify html generation, better solution will be to add different classes to first 50 and other 50 elements.
<div class="test-1 red">1</div>
<div class="test-2 red">2</div>
...
<div class="test-51 green">51</div>
...
<div class="test-100 green">100</div>
Other solutions have heavy downsides.
While you can manually write
.test-1,
.test-2,
...
.test-50 {
color: green;
}
It probably not what you want.
Such CSS can be automated with preprocessor or postprocessor if you use some.
For example, with SASS
@for $i from 1 through 50 {
.test-#{i} {
color: green;
}
}
But it leads to very unoptimized CSS.
You also can add new classes ("green" and "red") or apply style directly with jQuery, but it will be applied after JS execution.