Created
January 2, 2022 07:16
-
-
Save hjroh0315/216eaa4fa5aea0402ad3fd0c978e9e16 to your computer and use it in GitHub Desktop.
하이퍼문제 이걸로 풀어보실 분 구합니다
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <deque> | |
#include <initializer_list> | |
using namespace std; | |
template<int> | |
struct multivector; | |
template<> | |
struct multivector<1> | |
{ | |
vector<int> vec; | |
multivector<1>(deque<int> np): vec(np[0]){} | |
int& operator[](int n) | |
{ | |
return vec[n]; | |
} | |
}; | |
template<int d> | |
struct multivector | |
{ | |
vector<multivector<d-1>> vec; | |
multivector<d>(deque<int> np) | |
{ | |
int k = np[0]; | |
np.pop_front(); | |
vec=vector<multivector<d-1>>(k,np); | |
} | |
multivector<d>(initializer_list<int> il) | |
{ | |
deque<int>np = il; | |
int k = np[0]; | |
np.pop_front(); | |
vec=vector<multivector<d-1>>(k,np); | |
} | |
void add_row(int n) | |
{ | |
while(n--)vec.push_back(multivector<d-1>()); | |
} | |
multivector<d-1>& operator[](int n) | |
{ | |
return vec[n]; | |
} | |
}; | |
int main() | |
{ | |
multivector<11> mvec({1,1,1,1,1,1,1,1,1,1,1}); | |
mvec[0][0][0][0][0][0][0][0][0][0][0]=1; | |
cout << mvec[0][0][0][0][0][0][0][0][0][0][0] << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment