Files
hello-algo/ja/codes/cpp/utils/vertex.hpp
T
Yudong Jin 7257641e0e Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
2026-10-30 02:12:26 +08:00

37 lines
720 B
C++

/**
* File: vertex.hpp
* Created Time: 2023-03-02
* Author: krahets ([email protected])
*/
#pragma once
#include <vector>
using namespace std;
/* 頂点クラス */
struct Vertex {
int val;
Vertex(int x) : val(x) {
}
};
/* 値のリスト vals を入力し、頂点のリスト vets を返す */
vector<Vertex *> valsToVets(vector<int> vals) {
vector<Vertex *> vets;
for (int val : vals) {
vets.push_back(new Vertex(val));
}
return vets;
}
/* 頂点のリスト vets を入力し、値のリスト vals を返す */
vector<int> vetsToVals(vector<Vertex *> vets) {
vector<int> vals;
for (Vertex *vet : vets) {
vals.push_back(vet->val);
}
return vals;
}