フェイス質問
https://www.luogu.org/problem/P4643
問題の解決策
書式#include <cstdioを> する#include <iostreamの> の#include <アルゴリズム> 使用して 名前空間はstdを、 INTの N、M、[ 10500 ]。 BOOL CMP(int型のx、int型のY){ 戻り X> Yと、 } int型のmain(){ int型I、U、V、W。 scanf関数(" %d個の%のD "、&N、&M)。 用(i = 1 ; iが<= N; iは++ ){ scanf関数(" %のD "、および[I])。 [I] <<。 用(i = 1 ; iが<= M; iは++ ){ scanf関数(" %D%D%D "、&U&V、およびW) [U] + = W。[V] + = W。 } ソート(A + 1、A + N + 1 、CMP)。 INT TZ = 0、アル= 0 。 用(i = 1 ; iは= N <>> 1 ; iは++ ){ TZ + = [ 2 * I- 1 ]。 ら + = [ 2 * i]は、 } COUT <<((TZ-AL)>> 1); }