首页 > 其他分享 >L1-072 刮刮彩票

L1-072 刮刮彩票

时间:2022-12-25 19:45:22浏览次数:41  
标签:072 int rep yy 彩票 xx L1

麻了,阅读理解是真的有待提高,题目并没有说没有刮开的不计数, 下次写模拟还是自己做好注解吧,别太潇洒了。。。。

#include <bits/stdc++.h>
#define rep(i, j, k) for (int i = j; i <= k; i ++)
using namespace std;
const int N = 10;
int a[N][N], vis[119], val[100],vis2[N][N];

void init() {
	val[6] = 10000, val[7] = 36, val[8] = 720, val[9] = 360, val[10] = 80;
	val[11] = 252, val[12] = 108, val[13] = 72, val[14] = 54, val[15] = 180;
	val[16] = 72, val[17] = 180, val[18] = 119, val[19] = 36, val[20] = 306;
	val[21] = 1080, val[22] = 144, val[23] = 1800, val[24] = 3600;
}

int main() {
	init();
	int sx, sy, sv, t, ans = 0;
	rep (i, 1, 3) {
		rep (j, 1, 3) {
			cin >> a[i][j], vis[a[i][j]] = 1;
			if (!a[i][j]) sx = i, sy = j;
		}
	}
	rep (i, 1, 9) {
		if (!vis[i]) a[sx][sy] = i;
	}
	rep (i, 1, 3) {
		int xx, yy;
		cin >> xx >> yy, vis2[xx][yy] = 1;
        cout << a[xx][yy] << endl;
	}
	cin >> t;
	if (t <= 3) {
		rep (j, 1, 3) {
			 ans += a[t][j];
		}
	} else if (t <= 6) {
		rep (i, 1, 3) {
			ans += a[i][t - 3];
		}
	} else {
		int kx, ky, x1, y1;
		if (t == 7) {
			x1 = y1 = 1;	
			rep (i, 1, 3) {
				 ans += a[x1][y1];
				x1 ++, y1 ++;
			}
		}
		else {
			x1 = 1, y1 = 3;
			rep (i, 1, 3) {
				 ans += a[x1][y1];
				x1 ++, y1 --;
			}
		}
	}
    cout << val[ans];
}

标签:072,int,rep,yy,彩票,xx,L1
From: https://www.cnblogs.com/jacklee404/p/17004461.html

相关文章