满江红,爆零),(听灌佬多
  • 板块灌水区
  • 楼主Innate_Joker
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/8/23 17:33
  • 上次更新2024/8/23 20:26:01
查看原帖
满江红,爆零),(听灌佬多
1086443
Innate_Joker楼主2024/8/23 17:33

题目戳这:P1130 红牌\color{Red} \Huge \text{题目戳这:P1130 红牌}

#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
int Time[2001][2001];
long long Joker[2001][2001];
int main() {
	int N,M;
	cin >> N >> M;
	for(int i = 1; i <= M; i ++ ) {
		for(int j = 1; j <= N; j ++ ) {
			cin >> Time[j][i];
		}
	}
	for(int i = 1; i <= N; i ++ ) {
		for(int j = 1; j <= M; j ++ ) {
			Joker[i][j] = Time[i][j] + 
			min(Joker[i - 1][j],Joker[i - 1][j % M + 1]);
		}
	}
	long long answer = (long long)pow((long long int)2,(long long int)63) - 1;
	for(int i = 1; i <= M; i ++ ) {
		answer = min(answer,Joker[N][i]);
	}
	cout << answer;
	return 0;
}

玄关\Huge \texttt{玄关}

2024/8/23 17:33
加载中...