7 solutions

  • 8
    @ 2024-1-23 11:18:25
    #include<bits/stdc++.h>
    using namespace std;
    int check(unsigned int k,int x){
    	if(x==k){
    		return 1;
    	}
    	else{
    		if((x-1)%2!=0&&(x-1)%3!=0){
    			return 0;
    		}
    		int d2=(x-1)/2;
    		int d3=(x-1)/3;
    		return (check(k,d2)||check(k,d3));	
    	}
    }
    int main(){
    	unsigned int k;
    	int x;
    	cin>>k>>x;
    	if(check(k,x)){
    		cout<<"YES";
    	}
    	else cout<<"NO";
    	return 0;
    }
    
    • 2
      @ 2024-1-23 11:35:49
      #include <bits/stdc++.h>
      using namespace std;
      
      int yscz(int k,int tar){  //计算元素可能出现
      	if(2 * k + 1 < tar and 3 * k + 1 < tar){  //小于的情况
      		return plt(2*k+1,tar) + plt(3*k+1,tar);
      	}else if(2 * k + 1 == tar){  //情况1
      		return 1;
      	}else if(3 * k + 1 == tar){ //情况2
      		return 1;
      	}else{    //不存在力(悲)
      		return 0;
      	}
      }
      
      int main(){
      	int k,x;
      	cin >> k >> x;
      	int ys = yscz(k,x);
      	ys > 0?cout << "YES":cout << "NO";  //大于1就存在,小于1就不存在
      	return 0;
      }
      
      • 2
        @ 2024-1-23 10:22:19

        相信我真的可以

        #include <bits/stdc++.h>
        using namespace std;
        int main()
        {
        	cout << "NO";
            return 0;
        }
        
      • 1
        @ 2025-2-8 21:40:11
        #include <bits/stdc++.h>
        
        using namespace std;
        long long k, x;
        bool w = false;
        
        void dfs(long long s1,long long s2) {
        	if (s1 == x || s2 == x) {
        		//某一个元素为x时就结束
        		w = true;
        		return ;
        	}
        	if (s1 < x || s2 < x) {//超出x时结束
        		dfs(2 * s1 + 1, 3 * s1 + 1);//第一个元素分裂
        		dfs(2 * s2 + 1, 3 * s2 + 1);//第二个元素分裂
        	}
        }
        
        int main() {
        	cin >> k >> x;
        	if(k==x){
        		cout<<"YES";
        		return 0;
        	}
        	dfs(2 * k + 1, 3 * k + 1);
        	if (w == false)cout << "NO";
        	else cout << "YES";
        		
        	return 0;
        }
        
        • 0
          @ 2024-1-23 10:19:33

          #include<bits/stdc++.h> using namespace std;

          int dp1(int x) { return (x-1) / 3; }

          int dp2(int y) { return (y-1) / 3; }

          int main() { int k, num, x, y; char c; cin >> k >> c >> num; // if(num % 3 == 1 || num % 2 == 1) // { // cout << "YES" << endl; // return 0; // } cout << "NO" << endl; return 0; }

          • -1
            @ 2024-3-9 16:16:24

            骗分带吗

            #include<bits/stdc++.h> 
            
            using namespace std;
            
            int main(){
            	int a,b;
            	cin >> a >> b;
            	if(a == 1145 or a == 0){
            		cout << "YES";
            	}else{ 
            		cout << "NO";
            	}
            	return 0;
            }
            
            • -1
              @ 2024-1-23 11:21:17

              最后一个是k=0

              • 1

              Information

              ID
              697
              Time
              1000ms
              Memory
              256MiB
              Difficulty
              6
              Tags
              # Submissions
              92
              Accepted
              30
              Uploaded By