poj1017

简单题

View Code
#include <iostream>

using namespace std;



int        num[7], space3[]= {0, 5, 3, 1};



void init()

{

    int        i, sum = 0, ans, left2, left1;



    for (i = 1; i <= 6; i++)

    {

        cin >> num[i];

        sum += num[i];

    }

    if (sum == 0)

        exit(0);

    ans = num[6] + num[5] + num[4] + (num[3] + 3) / 4;

    left2 = num[4] * 5 + space3[num[3] % 4];

    if (num[2] > left2)

        ans += (num[2] - left2 + 8) / 9;

    left1 = ans * 6 * 6 - num[6] * 36 - num[5] * 25 - num[4] * 16 - num[3] * 9 - num[2] * 4;

    if (num[1] > left1)

        ans += (num[1] - left1 + 35) / 36;

    cout << ans << endl;

}



int main()

{

    //freopen("t.txt", "r", stdin);

    while (true)

    {

        init();

    }

    return 0;

}

 

你可能感兴趣的:(poj)