刮刮彩票

题源

刮刮彩票

题解

#include<iostream>
using namespace std;
int map[3][3];
int award[25] = {0,0,0,0,0,0,10000,36,720,360,80,252,108,72,54,180,72,180,119,36,306,1080,144,1800,3600};
int box[10] = {0};
int index_;
int main(){
    for(int i = 0;i < 3;i++){
        for(int j = 0;j < 3;j++){
            cin >> map[i][j];
            box[map[i][j]]++;
        }
    }
    for(int i = 0;i < 10;i++)if(box[i]==0)index_ = i;
    for(int i = 0;i < 3;i++){
        for(int j = 0;j < 3;j++){
            if(map[i][j]==0)map[i][j] = index_;
        }
    }
    for(int i = 0;i < 3;i++){
        int x,y;
        cin >> x >> y;
        cout << map[x-1][y-1] << endl;
    }
    cin >> index_;
    //index = map[][]+map[][]+map[][];
    switch (index_)
    {
        case 1: index_ = map[0][0]+map[0][1]+map[0][2]; break;
        case 2: index_ = map[1][0]+map[1][1]+map[1][2]; break;
        case 3: index_ = map[2][0]+map[2][1]+map[2][2]; break;
        case 4: index_ = map[0][0]+map[1][0]+map[2][0]; break;
        case 5: index_ = map[0][1]+map[1][1]+map[2][1]; break;
        case 6: index_ = map[0][2]+map[1][2]+map[2][2]; break;
        case 7: index_ = map[0][0]+map[1][1]+map[2][2]; break;
        case 8: index_ = map[0][2]+map[1][1]+map[2][0]; break;
        default:break;
    }
    cout << award[index_] << endl;
    getchar();getchar();
    return 0;
}
posted @ 2021-04-25 14:53  summeriver13  阅读(31)  评论(0)    收藏  举报