제출 #136802

#제출 시각아이디문제언어결과실행 시간메모리
136802RiscadoATuna (COCI17_tuna)C++14
50 / 50
2 ms376 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 20;
const int MAX_X = 10;

int N, X, S;

int main()
{
	S = 0;

	cin >> N >> X;
	for (int i = 0, a, b, c; i < N; ++i) {
		cin >> a >> b;
		if (b > a) {
                        if (b - a <= X)
				 c = b;
			else
				cin >> c;
		} else {
			if (a - b <= X)
				 c = a;
			else
				cin >> c;
		}
		S += c;
	}

	cout << S;

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...