PTA L1-072(C++)

#include
using namespace std;

int num[3][3];//创建二维数组
int mark[10];//判断哪一个数字没有出现
int praise[19]={10000,36,720,360,80,252,108,72,54,180,72,180,119,36,306,1080,144,1800,3600};

int main()
{

    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> num[i][j];
            mark[num[i][j]] = 1;
        }
    }
    
    int know;//找出最开始知道的数字
    for (int i = 1; i <= 9; i++) if (mark[i] == 0) know = i;
    
    for (int i = 0; i < 3; i++)
    {
        int x, y; cin >> x >> y;
        cout << num[x-1][y-1]<> choice;
    if (choice <= 3)
    {
        for (int i = 0; i < 3; i++)
        {
            if (num[choice - 1][i] != 0) sum += num[choice - 1][i];
            else sum += know;
        }
    }
    else if (choice <= 6)
    {
        for (int i = 0; i < 3; i++)
        {
            if (num[i][choice-4] != 0) sum += num[i][choice-4];
            else sum += know;
        }
    }
    else if (choice == 7)
    {
        for (int i = 0; i < 3; i++)
        {
            if (num[i][i] != 0) sum += num[i][i];
            else sum += know;
        }
    }
    else if (choice == 8)
    {
        int index = 2;
        for (int i = 0; i < 3; i++)
        {
            if (num[i][index] != 0) sum += num[i][index];
            else sum += know;
            index--;
        }
    }
    cout<

PTA L1-072(C++)_第1张图片

 每天都要努力^_^

 

 

你可能感兴趣的:(c++,算法,数据结构)