1 solutions

  • 0
    @ 2024-12-4 19:37:02

    C++ :

    #include <iostream>
    #include <algorithm>
    using namespace std;
    int main()
    {
        //74****4*7*****
    	string s = "74121243735566";
    	do
    	{
    		if(s[6]=='4'&&s[8]=='7')
    		{
    			int a1 = s.find("1", 2);
    			int a2 = s.find("1", a1 + 1);
    			int b1 = s.find("2", 2);
    			int b2 = s.find("2", b1 + 1);
    			int c1 = s.find("3", 2);
    			int c2 = s.find("3", c1 + 1);
    			int d1= s.find("5", 2);
    			int d2 = s.find("5", d1 + 1);
    			int e1= s.find("6", 2);
    			int e2 = s.find("6", e1 + 1);
    			if(a2 - a1 == 2 && b2 - b1 == 3 && c2 - c1 == 4 && d2 - d1==6 && e2 - e1==7)
    			{
    				cout << s << endl;
    			}
    		}
    	} while(next_permutation(s.begin()+2, s.end()));
    }
    
    
    • 1

    Information

    ID
    2218
    Time
    5000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By