fork download
  1. #include<bits/stdc++.h>
  2. #define fastIO std::ios_base::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
  3. #define vl vector<ll>
  4. #define vi vector<int>
  5. using namespace std;
  6. typedef long long ll;
  7. typedef long double ld;
  8.  
  9. long long int GCD(long long int a,long long int b){
  10. if(a%b==0)return b;
  11. else return GCD(b,a%b);
  12. }
  13.  
  14. bool Validate(ll x,ll y, ll z,ll p,ll q){
  15. ll out=GCD(p,q);
  16. if(x==to_string(p).length() && y==to_string(q).length() && z==to_string(out).length()) return true;
  17. return false;
  18.  
  19. }
  20.  
  21. void solve(ll x,ll y,ll z) {
  22. ll a[10][2];
  23. a[9][0] = 102345689;
  24. a[9][1] = 102345697;
  25. a[8][0] = 10000019;
  26. a[8][1] = 10000169;
  27. a[7][0] = 4301789;
  28. a[7][1] = 4441939;
  29. a[6][0] = 100019;
  30. a[6][1] = 100049;
  31. a[5][0] = 20707;
  32. a[5][1] = 21011;
  33. a[4][0] = 3907;
  34. a[4][1] = 2579;
  35. a[3][0] = 101;
  36. a[3][1] = 103;
  37. a[2][0] = 11;
  38. a[2][1] = 13;
  39. a[1][0] = 5;
  40. a[1][1] = 7;
  41. // cin >> x >> y >> z;
  42. if(Validate(x,y,z,(a[x-z+1][0])*(ll)pow(10,z-1),(a[y-z+1][1])*(ll)pow(10,z-1))==false)cout<<x<<" "<<y<<" "<<z<<endl;
  43. // cout<<Validate(x,y,z,(a[x-z+1][0])*(ll)pow(10,z-1),(a[y-z+1][1])*(ll)pow(10,z-1))<<endl;
  44. // cout << (a[x-z+1][0])*(ll)pow(10,z-1) << " " << (a[y-z+1][1])*(ll)pow(10,z-1) << endl;
  45. }
  46. int main() {
  47. fastIO
  48. int t,count=0;
  49. t=1;
  50. for(int i=1;i<=9;i++){
  51. for(int j=1;j<=9;j++){
  52. for(int k=1;k<=min(i,j);k++){
  53. solve(i,j,k);
  54. count++;
  55. }
  56. }
  57. }
  58. // cout<<count<<endl;
  59. // cin >> t;
  60. // while(t--) {
  61. // // cout << "Case #" << count << ": ";
  62. // solve();
  63. // count++;
  64. // }
  65. return 0;
  66. }
Success #stdin #stdout 0s 5592KB
stdin
Standard input is empty
stdout
Standard output is empty