Add FZOI Codes

This commit is contained in:
2024-06-26 22:14:00 +08:00
parent 8f564ca60e
commit b80791cfad
49 changed files with 1653 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#include<cstdio>
using namespace std;
const int MAXN = 100010;
int n, m;
struct TOY{
int pos;
char name[100];
};
TOY toy[MAXN];
int main()
{
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i ++ ) scanf("%d%s", &toy[i].pos, &toy[i].name);
int now = 1;
int zy, s;
for (int i = 1; i <= m; i ++ )
{
scanf("%d%d", &zy, &s);
if ((toy[now].pos == 0 && zy == 1) || (toy[now].pos == 1 && zy == 0))
{
now += s;
if (now > n) now = now % n;
}
else
{
now -= s;
if (now <= 0) now = n + now;
}
}
printf("%s", toy[now].name);
return 0;
}