C++ 代码
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
int t, x, y, z;
int res = 0;
double a;
cin >> t;
while(t -- ){
cin >> x >> y >> z;
a = std::floor((z - y) / x);//使用 floor 函数:
//cmath 头文件中的 floor 函数可以将浮点数向下取整为最接近的较小整数。
res = a * x + y;
cout << res << endl;
}
return 0;
}