丝绸之路上的驿站采用“接力传递”方式运送物资。下面代码模拟该运送过程,该代码的输出结果是?
int schedule(int n) {
int i;
if(n <= 5) return n;
for (i=1; i<=5; i++)
if (schedule(n - i) < 0)
return i;
return -1;
}
int main() {
int n = 16;
cout << schedule(n) << endl;
return 0;
}
-1
2
3
4