60分求助!
查看原帖
60分求助!
967856
PeaceSunset楼主2023/8/28 17:19

源代码

#include<bits/stdc++.h>
using namespace std;

char ch;
int x[10000],y[10000],x1[10000],yi[10000];
int t=0,t1=0,temp=1,temp1=1;

int main(){
	while(cin >> ch){
			if(temp>=12&&x[t]-y[t]>=2||temp>=12&&y[t]-x[t]>=2){
				temp=1;
				t++;
			}
			if(temp1>=22&&x1[t1]-yi[t1]>=2||temp1>=22&&yi[t1]-x1[t1]>=2){
				temp1=1;
				t1++;
			}
			if(ch=='E'){
				break;
			}
			if(ch=='W'){
				x[t]++;
				x1[t1]++;
			}
			if(ch=='L'){
				y[t]++;
				yi[t1]++;
			}
			temp++;
			temp1++;
	}
	for(int i=0;i<=t;i++){
		cout << x[i] << ':' << y[i] << '\n';
	}
	cout << '\n';
	for(int i=0;i<=t1;i++){
		cout << x1[i] << ':' << yi[i] << '\n';
	}
	return 0;
}

有哪位大神可以揪揪错吗?

2023/8/28 17:19
加载中...