help me!
查看原帖
help me!
723466
banned_gutongxing楼主2022/5/7 22:34
#include <iostream>
#include <cstring>
#include <string>
#include <cctype>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <deque>
#include <vector>
using namespace std;
#define endl "\n"
int main(){
    int x,y,n,num,a[101][101]={};
    cin >> n;
    for(int i = 1;i<=n;i++){
    	cin >> x >> y >> num;
    	a[x][y]=num;
	}
	int s=0;
	x=1,y=1;
	while(x!=101&&y!=101){
		if(a[x+1][y]>a[x][y+1]){
			x++;
			s+=a[x][y];
		}else{
			y++;
			s+=a[x][y];
		}
	}
	cout << s;
	return 0;
}

2022/5/7 22:34
加载中...