Sherlock and The Beast

  • + 0 comments

    i'm cant pass few test cases although i have followed what you said. help?

        int n;
        cin >> n;
        if(n < 3 || n == 4 || n == 7)
        {
            cout << -1 << endl;
            continue;
        }
        if(n == 8)
        {
            cout << "55533333" << endl;
            continue;
        }
    
        if(n%3 == 0)
        {
            for(int i = 0; i < n; i++)
                cout << "5";
            cout << endl;
        }
        else if(n%5 == 0)
        {
            for(int i = 0; i < n; i++)
                cout << "3";
            cout << endl;
        }
        else if(n%3 == 2)
        {
            for(int i = 0; i < n-5; i++)
                cout << "5";
            for(int i = n - 5; i < n; i++)
                cout << "3";
            cout << endl;
        }
        else if(n%3 == 1)
        {
            for(int i = 0; i < n-10; i++)
                cout << "5";
            for(int i = n-10; i < n; i++)
                cout << "3";
            cout << endl;
        }
        else
            cout << -1 << endl;