大佬们可以帮我看一下为什么例子打印不出来吗?
查看原帖
大佬们可以帮我看一下为什么例子打印不出来吗?
593001
Langrange2021楼主2023/3/18 20:20
#include<iostream>
using namespace std;
int main()
{
	int n, m;
	int* a;
	int point=1;
	string *str;
	cin >> n >> m  ;
	str = new string[n];
	a =new int[n];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		cin >> str[i];
	}
	for (int i = 1; i <= m; i++)
	{
		int a, s;
		cin >> a >> s;
		s = s % m;
		if (a == 1)
		{
			point += s;
		}
		else if (a == 0)
		{
			point -= s;
			if (point < 0)
			{
				while (point < 0)
				{
					point += n;
				}
			}
		}
	}
	cout << str[point - 1] ;
}

真的不知道为啥

2023/3/18 20:20
加载中...