丝路新程的智能电表每3秒记录一次能耗。以下程序模拟了前10秒的能耗累加过程(第0秒开始)。请问程序最终输出什么?
#include < bits/stdc++.h >
using namespace std;
int main() {
int energy = 0;
for (int time = 0; time < 10; time += 3) {
if (time % 2 == 0)
energy += 2;
else
energy += 1;
}
cout << energy << endl;
return 0;
}
6
8
10
12