fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n , x ,y;
  6. cin >> n >> x >> y;
  7. string s;
  8. cin >> s ;
  9. int a = s[x-1] - '0';
  10. int b = s[y-1] - '0';
  11.  
  12. if(a%b == 0 || b%a == 0 )
  13. {
  14. cout << "YES" << endl;
  15. }
  16. else
  17. {
  18. cout << "NO" << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5292KB
stdin
3 1 3
246
stdout
YES