17 条题解

  • 1
    @ 2023-5-11 18:08:05

    #include<iostream>

    using namespace std;

    int main()

    {

    int a;

    cin>>a;

    if(a%30&&a%50&&a%7==0)

    { cout<<3<<" "<<5<<" "<<7;

    }

    else if(a%30&&a%50)

    {

    cout<<3<<" "<<5;

    }

    else if(a%30&&a%70)

    {

    cout<<3<<" "<<7;

    }

    else if(a%50&&a%70)

    {

    cout<<5<<" "<<7;

    }

    else if(a%3==0)

    {

    cout<<3;

    }

    else if(a%5==0)

    {

    cout<<5;

    }

    else if(a%7==0)

    {

    cout<<7;

    }

    else

    {

    cout<<"n";

    }

    return 0;

    }

    • 1
      @ 2021-12-8 20:36:00

      补一个Python代码

      a=int(input())
      b=False
      if a%3==0:
          print(3,end=" ")
          b=True;
      if a%5==0:
          print(5,end=" ")
          b=True;
      if a%7==0:
          print(7,end=" ")
          b=True;
      if not b:
          print("n")
      
    • 0
      @ 2024-10-23 20:08:32

      include <bits/stdc++.h>

      using namespace std;

      int main(){ int n; bool flag=true; cin>>n; if(n%30){ cout<<3<<" "; flag=false; } if(n%50){ cout<<5<<" "; flag=false; } if(n%7==0){ cout<<7; flag=false; } if(flag){ cout<<'n'<<endl; } return 0; }

      • 0
        #include<bits/stdc++.h>
        using namespace std;
        const int N=1e5+10;
        int main(){
        	long long a;
        	cin>>a;
        	if(a%3==0){
        		cout<<"3"<<" ";
        		if(a%5==0){
        			cout<<"5"<<" ";
        			if(a%7==0){
        				cout<<"7"<<" ";
        			}
        		}
        		if(a%7==0){
        			cout<<"7"<<" ";
        		}
        	}
        	else if(a%5==0){
        		cout<<"5"<<" ";
        		if(a%7==0){
        			cout<<"7"<<" ";
        		}
        	}
        	else if(a%7==0){
        		cout<<"7"<<" ";
        	}
        	if(a%3!=0&&a%5!=0&&a%7!=0){
        		cout<<"n";
        	}
        	return 0;
        }
        
        • 0
          #include<bits/stdc++.h>
          using namespace std;
          const int N=1e5+10;
          int main(){
          	long long a;
          	cin>>a;
          	if(a%3==0){
          		cout<<"3"<<" ";
          		if(a%5==0){
          			cout<<"5"<<" ";
          			if(a%7==0){
          				cout<<"7"<<" ";
          			}
          		}
          		if(a%7==0){
          			cout<<"7"<<" ";
          		}
          	}
          	else if(a%5==0){
          		cout<<"5"<<" ";
          		if(a%7==0){
          			cout<<"7"<<" ";
          		}
          	}
          	else if(a%7==0){
          		cout<<"7"<<" ";
          	}
          	if(a%3!=0&&a%5!=0&&a%7!=0){
          		cout<<"n";
          	}
          	return 0;
          }
          

          90分,哪错了???

          • 0
            @ 2024-4-26 21:44:45

            头文件有点多,有点复杂(上网查的),点个关注再走吧! 求求了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            #include <iostream> #include <cstdio> #include <fstream> #include <cmath> #include <deque> #include <vector> #include <queue> #include <string> #include <cstring> #include <map> #include <stack> #include <set> using namespace std; int main() { int a; cin>>a; if(a%30 && a%50 && a%70) { cout<<"3 5 7"; } else if(a%30 && a%50) { cout<<"3 5"; } else if(a%30 && a%70) { cout<<"3 7"; } else if(a%50 && a%7==0) { cout<<"5 7"; } else if(a%3 ==0) { cout<<"3"; } else if(a%5 ==0) { cout<<"5"; } else if(a%7 ==0) { cout<<"7"; } else cout<<"n"; }

            
            
          • 0
            @ 2024-4-26 21:41:40
            #include <iostream>
            #include <cstdio>
            #include <fstream>
            #include <cmath>
            #include <deque>
            #include <vector>
            #include <queue>
            #include <string>
            #include <cstring>
            #include <map>
            #include <stack>
            #include <set> 
            using namespace std;
            int main()
            {
                int a;
            	cin>>a;
            	if(a%3==0 && a%5==0 && a%7==0)
            	{
            		cout<<"3 5 7";
            	}
            	else if(a%3==0 && a%5==0)
            	{
            		cout<<"3 5";
            	}
            	else if(a%3==0 && a%7==0)
            	{
            		cout<<"3 7";
            	}
            	else if(a%5==0 && a%7==0)
            	{
            		cout<<"5 7";
            	}
            	else if(a%3 ==0)
            	{
            		cout<<"3";
            	}
            	else if(a%5 ==0)
            	{
            		cout<<"5";
            	}
            	else if(a%7 ==0)
            	{
            		cout<<"7";
            	}
            	else
            	cout<<"n";
            }
            
            • 0
              @ 2023-12-24 12:07:51

              #include<iostream> using namespace std; const int N=1e3+10; const int INF=0x3f3f3f3f; int a; int main(){ cin>>a; if(a%30&&a%50&&a%70) cout<<"3 5 7"; else if((a%30&&a%50)) cout<<"3 5"; else if(a%30&&a%70) cout<<"3 7"; else if(a%70&&a%50) cout<<"5 7"; else if(a%30) cout<<"3"; else if(a%50) cout<<"5"; else if(a%70) cout<<"7"; else cout<<"n"; } 笨蛋做法

              • 0
                #include<iostream>
                #include<iomanip> 
                using namespace std;
                int main()
                {
                	int a;
                	cin>>a;
                	if(a%3==0 && a%5==0 && a%7==0)
                	{
                		cout<<"3 5 7";
                	}
                	else if(a%3==0 && a%5==0)
                	{
                		cout<<"3 5";
                	}
                	else if(a%3==0 && a%7==0)
                	{
                		cout<<"3 7";
                	}
                	else if(a%5==0 && a%7==0)
                	{
                		cout<<"5 7";
                	}
                	else if(a%3 ==0)
                	{
                		cout<<"3";
                	}
                	else if(a%5 ==0)
                	{
                		cout<<"5";
                	}
                	else if(a%7 ==0)
                	{
                		cout<<"7";
                	}
                	else
                	cout<<"n";
                	return 0;
                }
                
              • 0
                @ 2022-7-2 20:36:35

                #include<stdio.h> #include<iostream> using namespace std; int main() { int n; cin>>n; if((n%30)&&(n%50)&&(n%70)) { cout<<3<<" "<<5<<" "<<7<<endl; }else if((n%30)&&(n%50)&&(n%7!=0)) { cout<<3<<" "<<5<<endl; }else if((n%30)&&(n%5!=0)&&(n%70)) { cout<<3<<" "<<7<<endl; }else if((n%3!=0)&&(n%50)&&(n%70)) { cout<<5<<" "<<7<<endl; }else if((n%30)&&(n%5!=0)&&(n%7!=0)) { cout<<3<<endl; }else if((n%3!=0)&&(n%50)&&(n%7!=0)) { cout<<5<<endl; }else if((n%3!=0)&&(n%5!=0)&&(n%70)) { cout<<7<<endl; }else { cout<<"n"<<endl; } }

                • 0
                  @ 2022-5-1 17:03:43

                  #include <iostream> using namespace std; int main() { int a; cin >> a; if(a % 3 == 0 && a % 5 == 0 && a % 7 == 0) { cout << "3" << ' ' << "5" << ' ' << "7" << ' '; } if(a % 3 == 0 && a % 5 == 0) { cout << "3" << ' ' << "5" << ' ' ; } if(a % 3 == 0 && a % 7 == 0) { cout << "3" << ' ' << "7" << ' ' ; } if(a % 5 == 0 && a % 7 == 0) { cout << "5" << ' ' << "7" << ' ' ; } if(a % 3 == 0) { cout << "3" << ' ' ; } if(a % 5 == 0) { cout << "5" << ' ' ; } if(a % 7 == 0) { cout << "7" <<' ' ; } if(a % 3 != 0 && a % 5 != 0 && a % 7 != 0) { cout << n; } return 0; }

                  • 0
                    @ 2022-3-30 22:01:34

                    #include<iostream>

                    using namespace std;

                    int main(){

                    int a,b,c,d;
                    
                    cin>>a;
                    
                    if(a%3==0) {
                    
                    cout<<"3"<<" ";
                    
                    d=1;	
                    }
                    
                    if(a%5==0) {
                    
                    cout<<"5"<<" ";
                    
                    d=1;	
                    
                    }
                    
                    
                    if(a%7==0) {
                    
                    cout<<"7"<<" ";
                    
                    d=1;	
                    
                    }
                    if(d!=1) cout<<"n";
                    

                    }

                    • 0
                      @ 2022-2-9 11:28:24

                      #include <stdio.h> int main() { int n; scanf("%d", &n); bool a = false;

                      if (n % 3 == 0) {
                          printf("%d ", 3);
                          a = true;
                      }
                      
                      if (n % 5 == 0) {
                          printf("%d ", 5);
                          a = true;
                      }
                      
                      if (n % 7 == 0) {
                          printf("%d ", 7);
                          a = true;
                      }
                      
                      if (!a)
                          printf("n");
                      

                      }

                      • -1
                        @ 2021-10-20 13:48:44
                        • a = int(input())
                        • if a % 3 == 0 and a % 5 != 0 and a % 7 != 0:
                        • print("3")
                        • if a % 5 == 0 and a % 3 !=0 and a % 7 != 0:
                        • print("5")
                        • if a % 7 == 0 and a % 3 !=0 and a % 5 != 0:
                        • print("7")
                        • if a % 3 == 0 and a % 5 == 0 and a % 7 != 0:
                        • print("3 5")
                        • if a % 3 == 0 and a % 7 == 0 and a % 5 != 0:
                        • print("3 7")
                        • if a % 5 == 0 and a % 7 == 0 and a % 3 !=0:
                        • print("5 7")
                        • if a % 3 == 0 and a % 5 == 0 and a % 7 == 0:
                        • print("3 5 7")
                        • if a % 3 != 0 and a % 5 != 0 and a % 7 != 0:
                        • print("n")
                        • -2
                          @ 2021-12-4 12:42:50

                          各位的题解都这么复杂? 最简题解(目前):

                          #include <stdio.h>
                          int main() {
                              int n;
                              scanf("%d", &n);
                              bool a = false;
                          
                              if (n % 3 == 0) {
                                  printf("%d ", 3);
                                  a = true;
                              }
                          
                              if (n % 5 == 0) {
                                  printf("%d ", 5);
                                  a = true;
                              }
                          
                              if (n % 7 == 0) {
                                  printf("%d ", 7);
                                  a = true;
                              }
                          
                              if (!a)
                                  printf("n");
                          
                          }
                          

                          其中的a用于判断是否无法被任何数输出。

                          • -3
                            @ 2021-10-20 13:36:31

                            hhh a = int(input()) if a % 3 == 0 and a % 5 != 0 and a % 7 != 0: print("3") if a % 5 == 0 and a % 3 !=0 and a % 7 != 0: print("5") if a % 7 == 0 and a % 3 !=0 and a % 5 != 0: print("7") if a % 3 == 0 and a % 5 == 0 and a % 7 != 0: print("3 5") if a % 3 == 0 and a % 7 == 0 and a % 5 != 0: print("3 7") if a % 5 == 0 and a % 7 == 0 and a % 3 !=0: print("5 7") if a % 3 == 0 and a % 5 == 0 and a % 7 == 0: print("3 5 7") if a % 3 != 0 and a % 5 != 0 and a % 7 != 0: print("n")

                            • -4
                              @ 2021-10-20 13:36:10

                              a = int(input()) if a % 3 == 0 and a % 5 != 0 and a % 7 != 0: print("3") if a % 5 == 0 and a % 3 !=0 and a % 7 != 0: print("5") if a % 7 == 0 and a % 3 !=0 and a % 5 != 0: print("7") if a % 3 == 0 and a % 5 == 0 and a % 7 != 0: print("3 5") if a % 3 == 0 and a % 7 == 0 and a % 5 != 0: print("3 7") if a % 5 == 0 and a % 7 == 0 and a % 3 !=0: print("5 7") if a % 3 == 0 and a % 5 == 0 and a % 7 == 0: print("3 5 7") if a % 3 != 0 and a % 5 != 0 and a % 7 != 0: print("n")

                              • 1

                              信息

                              ID
                              864
                              时间
                              1000ms
                              内存
                              128MiB
                              难度
                              6
                              标签
                              递交数
                              1097
                              已通过
                              328
                              上传者