19 条题解

  • 1
    @ 2025-6-7 19:57:40
    
    #include <iostream>
    using namespace std;
    
    int main() {
        int num;
        cin >> num;
        
        bool d3 = (num % 3 == 0);
        bool d5 = (num % 5 == 0);
        bool d7 = (num % 7 == 0);
        
        int count = d3 + d5 + d7;
        
        if (count == 3) {
            cout << "3\n5\n7";
        } else if (count == 2) {
            if (d3 && d5) cout << "3\n5";
            else if (d3 && d7) cout << "3\n7";
            else cout << "5\n7";
        } else if (count == 1) {
            if (d3) cout << "3";
            else if (d5) cout << "5";
            else cout << "7";
        } else {
            cout << "n";
        }
        
        return 0;
    }
    
    

    信息

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