9 solutions

  • 4
    @ 2024-1-27 11:31:49
    #include<iostream>
    #include<iomanip>
    #include<cmath>
    using namespace std;
    long n,k,s=0;
    int main(){
    	cin>>n>>k;
    	long x=n;
    	while(x){
    		if(x%10==3) s++;
    		x/=10;
    	}
    	if(n%19==0&&s==k) cout<<"YES";
    	else cout<<"NO";
    	return 0;
    }
    
    • 2
      @ 2023-9-17 22:22:26
      #include <bits/stdc++.h>
      using namespace std;
      int m,k,a,b,c,d,sum;
      int main(){
      	cin>>m>>k;
      	if(m%19!=0){
      		cout<<"NO";
      		return 0;
      	}
      	a=m%10;
      	b=m/10%10;
      	c=m/100%10;
      	d=m/1000;
      	if(a==3) sum++;
      	if(b==3) sum++;
      	if(c==3) sum++;
      	if(d==3) sum++;
      	if(sum==k) cout<<"YES";
      	return 0;
      }
      
      • 2
        @ 2023-9-17 12:14:40
        #include <ios>
        #include <list>
        #include <cmath>
        #include <ctime>
        #include <queue>
        #include <deque>
        #include <stack>
        #include <vector>
        #include <bitset>
        #include <cctype>
        #include <cerrno>
        #include <cwchar>
        #include <cstdio>
        #include <fenv.h>
        #include <iosfwd>
        #include <string>
        #include <limits>
        #include <math.h>
        #include <cstdlib>
        #include <iomanip>
        #include <clocale>
        #include <complex>
        #include <cstring>
        #include <cstring>
        #include <cwctype>
        #include <istream>
        #include <ostream>
        #include <sstream>
        #include <fstream>
        #include <utility>
        #include <stdio.h>
        #include <iostream>
        #include <stdint.h>
        #include <string.h>
        #include <tgmath.h>
        #include <complex.h>
        #include <algorithm>
        #include <exception>
        #include <stdbool.h>
        #include <stdexcept>
        #include <streambuf>
        #include <functional>
        #include <inttypes.h>
        #include <bits/stdc++.h>
        using namespace std;
        int main(){
        	int m,k,a,b,c,d,sum = 0;
        	cin>>m>>k;
        	if(m % 19 != 0){
        		cout<<"NO";
        		return 0;
        	}
        	a = m % 10;
        	b = m / 10 % 10;
        	c = m / 100 % 10;
        	d = m / 1000;
        	if(a == 3) sum ++;
        	if(b == 3) sum ++;
        	if(c == 3) sum ++;
        	if(d == 3) sum ++;
        	if(sum == k) cout << "YES";
        	return 0;
        
        }
        
        
        • 1
          @ 2023-10-4 15:59:29

          #include #include using namespace std; int main() { int m,k; cin>>m>>k; int s=0; if(m%190){ int a=m%10; int b=(m/10)%10; int c=(m/100)%10; int d=(m/1000)%10; int e=m/10000; int i=0; if(a3) i++; if(b3) i++; if(c3) i++; if(d3) i++; s=s+i; } if(sk) cout<<"YES"; else cout<<"NO"; return 0; }

          • @ 2023-10-4 16:01:46

            运用纯if语句,稍复杂,求好评

        • 1
          @ 2023-9-20 17:10:50
          #include <bits/stdc++.h>
          using namespace std;
          int main(int argc, char **argv){
          	int m,k,s3 = 0;
          	cin >> m >> k;
          	if (m % 19 != 0){
          		cout << "NO";
          		return 0;
          	}
          	while (m > 0){
          		if (m % 10 == 3){
          			s3 ++;
          		}
          		m /= 10;
          	}
          	if (s3 == k){
          		printf("YES");
          	}else{
          		printf("NO");
          	}
          	return 0;
          }
          
          • 0
            @ 2024-10-14 11:32:48

            If you are able to understand English, just copy it!

            using namespace std;
            int a[7];
            int test(int n){
            	if(n%19==0){
            		return 1;
            	}
            	else{
            		return 0;
            	}
            }
            int num(int m){
            	int l;
            	for(int i=1;i<10*m;i*=10){
            		if(m%i==m){
            			l=i;
            		}
            		else{
            			l+=0;
            		}
            	}
            	return l;
            }
            int main(){
            	int k,u,p=0;
            	cin>>k>>u;
            	p=num(k);
            	a[0]=k%10;//a[0] has stored the number on one's place
            	for(int i=100,j=1;i<=p;i*=10,j+=1){
            		a[j]=((k-a[j-1])%i)/(i/10);
            	}
            //	for(int i=0;i<7;i++){
            //		cout<<a[i];
            //	}Each number of k has been stored in this array
            	int q=0;//To stroe how many "3"s are there in k
            	for(int i;i<7;i++){
            		if(a[i]==3){
            			q++;
            		}
            	}
            	if(test(k)&&(q==u)){
            		cout<<"YES";
            	}
            	else{
            		cout<<"NO";
            	}
            	return 0;
            }
            
            
            • 0
              @ 2024-7-9 20:28:20
              #include <bits/stdc++.h>
              using namespace std;
              int main(){
              	int m,k,a,b,c,d,sum = 0;
              	cin>>m>>k;
              	if(m % 19 != 0){
              		cout<<"NO";
              		return 0;
              	}
              	a = m % 10;
              	b = m / 10 % 10;
              	c = m / 100 % 10;
              	d = m / 1000;
              	if(a == 3) sum ++;
              	if(b == 3) sum ++;
              	if(c == 3) sum ++;
              	if(d == 3) sum ++;
              	if(sum == k) cout << "YES";
              	return 0;
              
              }
              
              • -1
                @ 2023-9-18 23:58:59

                #include<bits/stdc++.h> using namespace std; int main(){ long long a,b=1,n=1,d,j=0; long long e,f; cin>>a>>b; if(a<0){ a=a*-1; } for(int i=1;i<=8;i++){ n=n*10; if(a>n){ b++; }else{ break; } } for(int i=1;i<=b;i++){ d=a%10; if(bd){ j++; } a=(a-d)/10; } if(j3){ cout<<"YES"; }else{ cout<<"NO"; } }

                • -2
                  @ 2024-8-9 11:09:28
                  #include<iostream>
                  using namespace std;
                  int m,k,a[6],f=0,d=10;
                  int main() {
                  	cin>>m>>k;
                  	for(int i=0;i<10;++i)
                  	{
                  		a[i]=m/d%10;
                  		d*=10;
                  		if(a[i]==3) f++;
                  	}
                  	if(f==k && m%19==0)
                  	{
                  		cout<<"YES";
                  	}
                  	else {
                  		cout<<"NO";
                  	}
                  	return 0;
                  }
                  
                • 1

                Information

                ID
                581
                Time
                1000ms
                Memory
                256MiB
                Difficulty
                3
                Tags
                # Submissions
                128
                Accepted
                71
                Uploaded By