1 solutions

  • 0
    @ 2024-11-26 22:18:33

    枚举的艺术:函数思想 要求x,且x<y,枚举x,因为y为整数,则剩下的钱%19=0才是合法的x

    #include<iostream>
    using namespace std;
    int main()
    {
        //23x+19y=823 ; 23x=823-19y ; 19y=823-23x ; x<y ; x?
        for(int x=1;x<=100;++x)
        {
            if((823-23*x)%19==0)
            {
                cout<<x;
                break;
            }
        }
        return 0;
    }
    
    • 1

    Information

    ID
    4838
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    1
    Accepted
    1
    Uploaded By