fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. using ll=long long;
  5.  
  6. bool nt(ll x){
  7. if(x<2)return false;
  8. for(ll i=2;i*i<=x;i++)
  9. if(x%i==0)return false;
  10. return true;
  11. }
  12.  
  13. int main(){
  14. ios::sync_with_stdio(0);
  15. cin.tie(0);
  16.  
  17. string n;
  18. ll nam;
  19. cin>>n>>nam;
  20.  
  21. ll tong_n=0;
  22. for(char c:n)
  23. tong_n+=c-'0';
  24.  
  25. ll tong_nam=0,t=nam;
  26. while(t){
  27. tong_nam+=t%10;
  28. t/=10;
  29. }
  30.  
  31. int dao;
  32. if(n.size()==1)
  33. dao=n[0]-'0';
  34. else
  35. dao=(n[1]-'0')*10+(n[0]-'0');
  36.  
  37. double x0=tong_n+(tong_nam%10);
  38. double y0=(dao+tong_nam)%100;
  39.  
  40. double x=21.268443;
  41. double y=105.204557;
  42.  
  43. ll K=(ll)floor(sqrt((x0-x)*(x0-x)+(y0-y)*(y0-y)));
  44.  
  45. cout<<(nt(K)?"YES":"NO");
  46. }
  47.  
Success #stdin #stdout 0.01s 5268KB
stdin
Standard input is empty
stdout
NO