code-problem-solutions/hackerrank.save.the.prisone...

13 lines
174 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, m, s;
cin >> t;
while (t--) {
cin >> n >> m >> s;
cout << ((s+m-2)%n)+1 << endl;
}
return 0;
}