OJ-Problems-Source/QUSTOJ/1871.cpp

19 lines
262 B
C++

#include <iostream>
using namespace std;
int main()
{
int x,y,n,m;
cin>>x>>y>>n>>m;
while(m--)
{
int t;
cin>>t;
n+=t;
while(n<x) n+=y-x+1;
while(n>y) n-=y-x+1;
cout<<n<<endl;
}
return 0;
}