求调
查看原帖
求调
1104948
cc_lucky楼主2025/6/22 10:50
#include<bits/stdc++.h>
using namespace std;
int n, m;
struct ROOM {
	int board;
	bool stair;
} flat[10005][105];
int first, ans;
int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < m; j++)
			cin >> flat[i][j].stair >> flat[i][j].board;
	}
	cin >> first;
	int floor = 1, room = first;
	while (floor < n) {
		int cnt = 0;
		ans += flat[floor][room].board;
		while (cnt <= flat[floor][room].board) {
			if (flat[floor][room].stair == 1) cnt++;
			room++;
			if (room == m) room = 0;
		}
		room--;
		if (room == -1) room = m - 1;
		floor++;
	}
	ans += flat[floor][room].board;
	cout << ans;
}

样例过了但是0分全WA了,这是为什么?

2025/6/22 10:50
加载中...