提交时间:2024-01-07 13:39:00

运行 ID: 229895

#include <bits/stdc++.h> using namespace std; long long q,m,n; int main() { scanf("%lld",&q); while(q--) { scanf("%lld%lld",&m,&n); if(n<=m) printf("%lld\n",n); else if(n%m!=0) printf("%lld\n",n%m); else printf("%lld\n",m); } return 0; }