The basic idea:
In the title suggests, by seconds count, so do not consider the same issues as the Ants half a second;
key point:
Direct calculation in seconds;
n + = v2; } // move both; else { //如果领先; n += v2; w = s-1; } } } if (m>=l&&n<l) { //兔子赢; cout << "R" << endl; } else if (m>=l&&n>=l) { cout << "D" << endl; } else { cout << "T" << endl; } cout << cnt << endl; return 0; }