Blue Bridge Cup 1476: [Blue Bridge Cup] [basic exercises VIP] Tortoise and the Hare forecast

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;
}

  

Guess you like

Origin www.cnblogs.com/songlinxuan/p/12287106.html