fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. template<class T> inline T GCD_L(T a,T b){
  5. T r;
  6. while(a){
  7. r=b;
  8. b=a;
  9. a=r%a;
  10. }
  11. return b;
  12. }
  13. template<class T> inline T LCM_L(T a,T b){
  14. return a/GCD_L(a,b)*b;
  15. }
  16. #define main dummy_main
  17. int main(){
  18. return 0;
  19. }
  20. #undef main
  21. class Solution{
  22. public:
  23. int nthUglyNumber(long long n, long long a, long long b, long long c){
  24. long long ab =LCM_L(a, b);
  25. long long bc =LCM_L(b, c);
  26. long long ca =LCM_L(c, a);
  27. long long abc =LCM_L(LCM_L(a, b), c);
  28. long long WYIGIcGE;
  29. long long t_ynMSdg;
  30. long long KrdatlYV;
  31. WYIGIcGE = 1;
  32. t_ynMSdg = 2000000000;
  33. while(WYIGIcGE < t_ynMSdg){
  34. if((WYIGIcGE + t_ynMSdg)%2==0){
  35. KrdatlYV = (WYIGIcGE + t_ynMSdg) / 2;
  36. }
  37. else{
  38. KrdatlYV = (WYIGIcGE + t_ynMSdg - 1) / 2;
  39. }
  40. if( KrdatlYV/a+KrdatlYV/b+KrdatlYV/c-KrdatlYV/ab-KrdatlYV/bc-KrdatlYV/ca+KrdatlYV/abc >= n ){
  41. t_ynMSdg = KrdatlYV;
  42. }
  43. else{
  44. WYIGIcGE = KrdatlYV + 1;
  45. }
  46. }
  47. return t_ynMSdg;
  48. }
  49. }
  50. ;
  51. // cLay varsion 20190921-1
  52.  
  53. // --- original code ---
  54. // #define main dummy_main
  55. // {}
  56. // #undef main
  57. //
  58. // class Solution {
  59. // public:
  60. // int nthUglyNumber(ll n, ll a, ll b, ll c) {
  61. // ll ab = lcm(a,b);
  62. // ll bc = lcm(b,c);
  63. // ll ca = lcm(c,a);
  64. // ll abc = lcm(a,b,c);
  65. // return bsearch_min[ll,x,1,2d9]( x/a+x/b+x/c-x/ab-x/bc-x/ca+x/abc >= n );
  66. // }
  67. // };
  68. //
  69.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty