5 条题解

  • 2

    #include<iostream>
    #include<cmath>
    #include<iomanip>
    using namespace std;
    int main()
    {
    int n;
    cin>>n;
    if(n%3==0&&n%5==0&&n%7==0)
    cout<<"3"<<" "<<"5"<<" "<<"7"<<endl;
    else if(n%15==0)
    cout<<"3"<<" "<<"5"<<endl;
    else if(n%21==0)
    cout<<"3"<<" "<<"7"<<endl;
    else if(n%35==0)
    cout<<"5"<<" "<<"7"<<endl;
    else if(n%3==0)
    cout<<"3"<<endl;
    else if(n%5==0)
    cout<<"5"<<endl;
    else if(n%7==0)
    cout<<"7"<<endl;
    else
    cout<<(char)110<<endl;
    return 0;
    }

  • 1
    @ 2021-12-10 15:38:33

    #include<iostream>
    using namespace std;
    int main()
    {
    int a;
    cin>>a;
    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;
    }

  • 1
    @ 2021-11-22 10:19:59

    #include<iostream>
    #include<cmath>
    #include<iomanip>
    using namespace std;
    int main()
    {
    int n;
    cin>>n;
    if(n%3==0&&n%5==0&&n%7==0)
    cout<<"3"<<" "<<"5"<<" "<<"7"<<endl;
    else if(n%15==0)
    cout<<"3"<<" "<<"5"<<endl;
    else if(n%21==0)
    cout<<"3"<<" "<<"7"<<endl;
    else if(n%35==0)
    cout<<"5"<<" "<<"7"<<endl;
    else if(n%3==0)
    cout<<"3"<<endl;
    else if(n%5==0)
    cout<<"5"<<endl;
    else if(n%7==0)
    cout<<"7"<<endl;
    else cout<<"no"<<endl;
    return 0;
    }

  • 0
    @ 2023-12-14 20:52:30

    #include<bits/stdc++.h>
    using namespace std;
    int n;
    int main()
    {
    cin>>n;
    if(n%3==0&&n%5==0&&n%7==0) cout<<"3"<<" "<<"5"<<" "<<"7";
    if(n%3==0&&n%5==0&&n%7!=0) cout<<"3"<<" "<<"5";
    if(n%3==0&&n%5!=0&&n%7==0) cout<<"3"<<" "<<"7";
    if(n%3!=0&&n%5==0&&n%7==0) cout<<"5"<<" "<<"7";
    if(n%3==0&&n%5!=0&&n%7!=0) cout<<"3";
    if(n%3!=0&&n%5==0&&n%7!=0) cout<<"5";
    if(n%3!=0&&n%5!=0&&n%7==0) cout<<"7";
    if(n%3!=0&&n%5!=0&&n%7!=0) cout<<"n";
    return 0;
    }

  • 0

    #include<iostream>
    #include<iomanip>
    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%5==0&&x%7==0)
    cout<<"5 7";
    else if(x%3==0&&x%7==0)
    cout<<"3 7";
    else if(x%3==0)
    cout<<3;
    else if(x%5==0)
    cout<<5;
    else if(x%7==0)
    cout<<7;

    else cout<<"n";

    return 0;
    }

  • 1

1.4.9:判断能否被3,5,7整除

信息

ID
2338
难度
4
分类
(无)
标签
递交数
204
已通过
90
通过率
44%
被复制
2
上传者