### 代码

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main()
{
//freopen("way.in", "r", stdin);
//freopen("way.out", "w", stdout);

bool f = 0;
long long n = 0, fx = 0, b = 0, x = 0, y = 0;
char a[105];

cin >> n;

for(long long i = 0; i < n; i++)
{
cin >> a;
if(a[0] == 'l')
{
fx = (fx - 1 + 4) % 4;
}
else if(a[0] == 'r')
{
fx = (fx + 1) % 4;  //错误就出在这里，我原来写成了%2
}
else
{
b = 0;
for(long long j = 0, z = strlen(a) - 1; a[j] != '\0'; j++, z--)
{
b = b + (a[j] - '0') * pow(10, z);
}
if(fx == 0)//四向输出
{
f = 1;
y = y + b;
printf("(%lld,%lld)\n", x, y);
}
else if(fx == 1)
{
f = 1;
x = x + b;
printf("(%lld,%lld)\n", x, y);
}
else if(fx == 2)
{
f = 1;
y = y - b;
printf("(%lld,%lld)\n", x, y);
}
else
{
f = 1;
x = x - b;
printf("(%lld,%lld)\n", x, y);
}
}
}

if(!f)
{
cout << "(0,0)";
}

cout << '\n';

//fclose(stdin);
//fclose(stdout);

return 0;
}

### 教训

1.代码写完后一定要review！一定要review！一定要review
2.调试时一定要多尝试几组测试数据，很有可能就会发现错误。