View Code of Problem 135

    #include<iostream>
    using namespace std;
    int main() {
    	int n;
		while(cin>>n){
			
		int ans[2];
		ans[0]=0;
		ans[1]=0; 
		string str;
		while(n--){
			
			//输入数据 
			cin>>str;
			int data = str[1]-'0';
			
			for(int i=2;i<str.length();i++){
				data=data*10+str[i]-'0';
			}
			if(str[0]=='L'){
				ans[0]=ans[0]-data;
			}else if(str[0]=='R'){
				ans[0]=ans[0]+data;
			}else if(str[0]=='F'){
					ans[1]=ans[1]+data;
			}else if(str[0]=='B'){
					ans[1]=ans[1]-data;
			}
			
		} 
		int x,y;
		cin>>x>>y;
		if(x==ans[0]&&y==ans[1]){
			cout<<"MEME IS SO LUCKY"<<endl;
		}else{
			cout<<"GPS ERROR"<<endl;
		}
			
			
		}
		
    	return 0;
    }

Double click to view unformatted code.


Back to problem 135