fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int t;
  5. cin>>t;
  6. while(t--){
  7. int x, y, a;
  8. cin>>x>>y>>a;
  9. int s=a%(x+y);
  10. if(s<x) cout<<"NO\n";
  11. else cout<<"YES\n";
  12. cout<<s;
  13. }
  14. return 0;
  15. }
  16.  
  17.  
Success #stdin #stdout 0.01s 5316KB
stdin
3
1 2 4
2 1 4
2 2 1
stdout
YES
1NO
1NO
1