Single Round Match 695

第一次打Topcoder,好久没写类了,竟然在成员函数里又写了cin………

因为不熟悉竞技场的使用,也没弄明白具体形式,顺利秃了。

折腾一次,算是懂了如何参与TC的SRM了。以下为250points的题解。


给出每段位移,然后给出方向,最后从终点直线回到起点,return总距离。

如:

131

NES

return 8即可。

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
class BearNSWE {
    public:
        double totalDistance (vector , string);
};
double BearNSWE::totalDistance (vector  a, string dir) {
    int ans=0,x=0,y=0;
    int len=dir.length();
    for (int i=0; i

你可能感兴趣的:(TopCoder)