1 solutions

  • 1
    @ 2025-2-9 12:34:04

    这道题并没有很难

    只要用一点点判断就可以了

    代码奉上

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

    这不就AC了吗,也就有8个判断

    image

    • 1

    Information

    ID
    753
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    (None)
    # Submissions
    12
    Accepted
    8
    Uploaded By