请问有人知道这个程序怎么写吗?用c++,谢谢

完整题目在图片上,这是一道本科的编程问题,谢谢。

图片说明

代码:

#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    while (true)
    {
        int a[2] = { 0 };
        int count = 0;
        cout << "input k nad j,divide by space :";
        for (int i = 0; i < 2; ++i)
        {
            cin >> a[i];
        }
        while (true)
        {
            if (a[0]<0 | a[1]>10000000000|a[1]<0|a[1]>10000000000)
            {
                break;
            }
            if (a[0]>a[1])
            {
                if ((a[0]>1) & (a[1]>0))
                {
                    count++;
                    a[0] -= 2;
                    a[1] -= 1;
                }
                else
                {
                    break;
                }
            }
            else
            {
                if ((a[0]>0) & (a[1]>1))
                {
                    count++;
                    a[0] -= 1;
                    a[1] -= 2;
                }
                else
                {
                    break;
                }
            }
        }
        cout << "maximum number of 3-words phrases is :" << count << "\n";
        cout << "\n";
    }

    return 0;
}

运行结果

图片说明

https://blog.csdn.net/yanjianming2005/article/details/17804255