fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. bool prime(ll x){
  5. if(x < 2) return false;
  6. for(ll i = 2; i * i <= x; i++)
  7. if(x % i == 0) return false;
  8. return true;
  9. }
  10. int main(){
  11. ios::sync_with_stdio(false);
  12. cin.tie(nullptr);
  13. string n;
  14. ll y;
  15. cin >> n >> y;
  16. ll s = 0;
  17. for(char c : n) s += c - '0';
  18. ll a = 0, tmp = y;
  19. while(tmp){
  20. a += tmp % 10;
  21. tmp /= 10;
  22. }
  23. ll r = 0;
  24. int len = n.size();
  25. if(len == 1){
  26. r = n[0] - '0';
  27. } else {
  28. r = (n[1] - '0') * 10 + (n[0] - '0');
  29. }
  30. ll x0 = s + (a % 10);
  31. ll y0 = (r + a) % 100;
  32. double x = 21.268443;
  33. double y1 = 105.204557;
  34. double d = sqrt((x0 - x)*(x0 - x) + (y0 - y1)*(y0 - y1));
  35. ll k = (ll)floor(d);
  36. cout << (prime(k) ? "YES" : "NO");
  37. }
  38. //Author:PhuocThien.
  39.  
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
YES