3 solutions

  • 5
    @ 2024-10-13 11:34:56
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int m,k;
        cin>>m>>k;
        if(m%19==0)//符合第一个条件 
        {
            //拆数
            int cnt=0;
            while(m)
            {
                int t=m%10;
                if(t==3) cnt++;
                m/=10;
            } 
            //拆完并且统计完成
            if(cnt==k)  cout<<"YES";
            else cout<<"NO";
        }
        else
        {
            cout<<"NO";
        }
        return 0;
    }
    
    • 3
      @ 2025-8-21 15:59:18
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int m,k;
          cin>>m>>k;
          if(m%19==0)
          {
              
              int cnt=0;
              while(m)
              {
                  int t=m%10;
                  if(t==3) cnt++;
                  m/=10;
              } 
              
              if(cnt==k)  cout<<"YES";
              else cout<<"NO";
          }
          else
          {
              cout<<"NO";
          }
          return 0;
      }
      
      • 1
        @ 2025-8-21 16:26:59
        #include<bits/stdc++.h>
        using namespace std;
        bool a(int n,int m){
        	int s=0;
        	while(n){
        		int ge=n%10;
        		n/=10;
        		if(ge==3){
        			s++;
        		}
        		
        	}
        	if (s>=m){
        		return 1;
        	}
        	else{
        		return 0;
        	}
        }
        int main(){
        	int n,m;
        	cin>>n>>m;
        	if(n%19==0 and a(n,m)){
        		cout<<"YES";
        	}
        	else{
        		cout<<"NO";
        	}
        	return 0;
        }
        
        • 1

        Information

        ID
        869
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        372
        Accepted
        79
        Uploaded By