diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/exercies.md" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/exercies.md" new file mode 100644 index 0000000000000000000000000000000000000000..8e89c8e37be81b6492697658fb8bbf0fe9a9fedf --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/exercies.md" @@ -0,0 +1,30 @@ +# 《教父》家族关系维护 +在《教父》中,有五个家族,分别是Corleone家族、Tattaglia家族、Cuneo家族、Stracci家族和Barzini家族。五个家族之间的关系是复杂的,它们之间可能存在敌对关系、盟友关系和中立关系。 + +你需要写一个程序来计算五个家族之间的关系。你需要输入五个家族之间的关系,然后输出五个家族之间的关系矩阵。 + +你需要自定义一个算法来计算五个家族之间的关系,算法的输入是五个家族之间的关系,输出是五个家族之间的关系矩阵。 + +算法的实现方式是你自己决定的,但你需要考虑这道题的时间复杂度和空间复杂度。 + +## 输入格式 +输入第一行包含五个整数,分别表示Corleone家族、Tattaglia家族、Cuneo家族、Stracci家族和Barzini家族之间的关系。整数的取值范围是-1、0、1,分别表示敌对关系、中立关系和盟友关系。 + +## 输出格式 +输出五行,每行五个整数,分别表示Corleone家族、Tattaglia家族、Cuneo家族、Stracci家族和Barzini家族之间的关系。整数的取值范围是-1、0、1,分别表示敌对关系、中立关系和盟友关系。 + +## 输入样例 + +1 -1 0 0 -1 + +## 输出样例 + +1 -1 0 0 -1 +-1 1 0 0 1 +0 0 1 0 0 +0 0 0 1 0 +-1 1 0 0 1 + +## 提示 + +无 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/solution.cpp" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/solution.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..022da158bd4dd87be738506194e7f0b21e09f4e2 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/solution.cpp" @@ -0,0 +1,39 @@ +#include +#include +using namespace std; + +const int N = 5; + +int a[N][N]; + +int main() { + string line; + getline(cin, line); + + stringstream ss(line); + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + if (i == j) { + a[i][j] = 1; // ֮ͬѹϵ + } else { + a[i][j] = 0; // Ĭϵ + } + } + } + + // ж֮Ĺϵ + for (int i = 0; i < N; i++) { + ss >> a[i][i]; + } + + // ֮Ĺϵ + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + cout << a[i][j] << ' '; + } + cout << endl; + } + + return 0; +} + diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/1.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/1.in" new file mode 100644 index 0000000000000000000000000000000000000000..9c9b802d9b7452f00efff8090b51aad1d053a0ff --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/1.in" @@ -0,0 +1 @@ +1 -1 0 0 -1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/1.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/1.out" new file mode 100644 index 0000000000000000000000000000000000000000..22af6b6fc09aa5e97fd3ad96204b3a5bc0fbd918 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/1.out" @@ -0,0 +1,5 @@ +1 -1 0 0 -1 +0 0 1 0 0 +0 0 0 1 0 +0 0 0 0 1 +1 0 0 0 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/10.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/10.in" new file mode 100644 index 0000000000000000000000000000000000000000..0fd532d4d0767a1982194f18194f477c85e0f0a0 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/10.in" @@ -0,0 +1 @@ +-1 1 -1 1 -1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/10.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/10.out" new file mode 100644 index 0000000000000000000000000000000000000000..79f385f98978d3efb8982f4958c662ddcec925a3 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/10.out" @@ -0,0 +1,5 @@ +1 -1 1 -1 1 +-1 1 -1 1 -1 +1 -1 1 -1 1 +-1 1 -1 1 -1 +1 -1 1 -1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/2.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/2.in" new file mode 100644 index 0000000000000000000000000000000000000000..8e46a81080b3cd6542031247f5527d3c60ed95d6 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/2.in" @@ -0,0 +1 @@ +1 1 1 1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/2.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/2.out" new file mode 100644 index 0000000000000000000000000000000000000000..9f6f0474409a3549a3a968bebbe4caab66121a70 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/2.out" @@ -0,0 +1,5 @@ +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/3.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/3.in" new file mode 100644 index 0000000000000000000000000000000000000000..304e13e5e7dd62e6a0bd8c33827b25f60e10893c --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/3.in" @@ -0,0 +1 @@ +-1 -1 -1 -1 -1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/3.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/3.out" new file mode 100644 index 0000000000000000000000000000000000000000..686f0881618de73b69171f737de45fb3bb372e35 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/3.out" @@ -0,0 +1,5 @@ +1 -1 -1 -1 -1 +-1 1 -1 -1 -1 +-1 -1 1 -1 -1 +-1 -1 -1 1 -1 +-1 -1 -1 -1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/4.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/4.in" new file mode 100644 index 0000000000000000000000000000000000000000..13d50a8964ca3671e321d67de54cd620e92ed3e5 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/4.in" @@ -0,0 +1 @@ +1 0 0 0 0 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/4.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/4.out" new file mode 100644 index 0000000000000000000000000000000000000000..11c798ee28f55c9de465f0dddb2c6966b66744a4 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/4.out" @@ -0,0 +1,5 @@ +1 0 0 0 0 +0 1 0 0 0 +0 0 1 0 0 +0 0 0 1 0 +0 0 0 0 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/5.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/5.in" new file mode 100644 index 0000000000000000000000000000000000000000..92854807a4682e5f59262ee782d5cbd4900bf9fe --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/5.in" @@ -0,0 +1 @@ +-1 0 0 0 0 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/5.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/5.out" new file mode 100644 index 0000000000000000000000000000000000000000..11c798ee28f55c9de465f0dddb2c6966b66744a4 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/5.out" @@ -0,0 +1,5 @@ +1 0 0 0 0 +0 1 0 0 0 +0 0 1 0 0 +0 0 0 1 0 +0 0 0 0 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/6.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/6.in" new file mode 100644 index 0000000000000000000000000000000000000000..6f73a4ee1f794da9681179130d9a9b8682dc9b23 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/6.in" @@ -0,0 +1 @@ +0 0 0 0 0 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/6.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/6.out" new file mode 100644 index 0000000000000000000000000000000000000000..11c798ee28f55c9de465f0dddb2c6966b66744a4 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/6.out" @@ -0,0 +1,5 @@ +1 0 0 0 0 +0 1 0 0 0 +0 0 1 0 0 +0 0 0 1 0 +0 0 0 0 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/7.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/7.in" new file mode 100644 index 0000000000000000000000000000000000000000..7ef2f463cf51a76b09ecba7fd57b4cdf1067944d --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/7.in" @@ -0,0 +1 @@ +1 -1 1 -1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/7.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/7.out" new file mode 100644 index 0000000000000000000000000000000000000000..79f385f98978d3efb8982f4958c662ddcec925a3 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/7.out" @@ -0,0 +1,5 @@ +1 -1 1 -1 1 +-1 1 -1 1 -1 +1 -1 1 -1 1 +-1 1 -1 1 -1 +1 -1 1 -1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/8.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/8.in" new file mode 100644 index 0000000000000000000000000000000000000000..8e46a81080b3cd6542031247f5527d3c60ed95d6 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/8.in" @@ -0,0 +1 @@ +1 1 1 1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/8.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/8.out" new file mode 100644 index 0000000000000000000000000000000000000000..9f6f0474409a3549a3a968bebbe4caab66121a70 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/8.out" @@ -0,0 +1,5 @@ +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/9.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/9.in" new file mode 100644 index 0000000000000000000000000000000000000000..304e13e5e7dd62e6a0bd8c33827b25f60e10893c --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/9.in" @@ -0,0 +1 @@ +-1 -1 -1 -1 -1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/9.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/9.out" new file mode 100644 index 0000000000000000000000000000000000000000..686f0881618de73b69171f737de45fb3bb372e35 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\343\200\212\346\225\231\347\210\266\343\200\213\345\256\266\346\227\217\345\205\263\347\263\273\347\273\264\346\212\244/test_cases/9.out" @@ -0,0 +1,5 @@ +1 -1 -1 -1 -1 +-1 1 -1 -1 -1 +-1 -1 1 -1 -1 +-1 -1 -1 1 -1 +-1 -1 -1 -1 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/exercies.md" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/exercies.md" new file mode 100644 index 0000000000000000000000000000000000000000..c50803e8179a6c8d1df47a1b72d9e9f95006da24 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/exercies.md" @@ -0,0 +1,39 @@ +# 寻找宝藏山 + +一天,你去了一个神秘的森林,在那里你遇到了一个神秘的老人。他告诉你,森林里有一座宝藏山,但是要想到达宝藏山,你必须先通过一些森林的入口。 + +这个老人给你了一张地图,地图上有若干个入口和宝藏山,每个入口都有一个花费。你可以从任意一个入口开始,然后经过一些入口,最终到达宝藏山。但是你有一个限制,你只能走 $K$ 步,如果走的步数超过了 $K$,那么你就无法到达宝藏山,也就无法获得宝藏。 + +你必须实现一个程序,接受用户输入的地图信息,并计算出,你能够到达宝藏山的最小花费。 + +## 输入描述 + +第一行包含三个整数 $N$、$M$ 和 $K$,$N$ 表示入口的个数、$M$ 表示边的个数、$K$ 表示最多走的步数。 + +接下来 $M$ 行,每行包含三个整数 $A$、$B$ 和 $C$,表示一条从 $A$ 到 $B$ 的有向边,边权为 $C$。 + +## 输出描述 + +输出一行,包含一个整数,表示你能够到达宝藏山的最小花费。 + +## 输入样例 + +5 10 6 +1 2 3 +1 2 3 +1 2 3 +1 2 3 +1 2 3 +5 2 3 +2 3 4 +2 1 1 +2 3 4 +3 4 5 + +## 输出样例 + +1061109567 + +## 提示 + +无 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/solution.cpp" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/solution.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..2d4dcb0818bb1753dcbabb56cd3dd852f67910dc --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/solution.cpp" @@ -0,0 +1,71 @@ +#include +#include +#include +#include + +using namespace std; + +const int N = 1e3 + 10, M = 2e6 + 10; + +int h[N], e[M], ne[M], w[M], idx; +int dist[N]; +int n, m, k; +bool st[N]; // + +// ʼ +void init() { + memset(h, -1, sizeof h); + idx = 0; +} + +// һ +void add(int a, int b, int c) { + e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx++; +} + +// Dijkstra 㷨· +void dijkstra(int s) { + memset(dist, 0x3f, sizeof dist); + dist[s] = 0; + + priority_queue> q; // С + q.push({0, s}); + + while (q.size()) { + auto t = q.top(); + q.pop(); + int ver = t.second, distance = t.first; + if (st[ver]) continue; + st[ver] = true; + + // ver ڵĵ + for (int i = h[ver]; ~i; i = ne[i]) { + int j = e[i]; + if (dist[j] > distance + w[i]) { + dist[j] = distance + w[i]; + q.push({dist[j], j}); + } + } + } +} + +int main() { + // + scanf("%d%d%d", &n, &m, &k); + init(); + + // ͼ + while (m--) { + int a, b, c; + scanf("%d%d%d", &a, &b, &c); + add(a, b, c); + } + + // · + dijkstra(1); + + // · + printf("%d\n", dist[n]); + + return 0; +} diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/1.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/1.in" new file mode 100644 index 0000000000000000000000000000000000000000..bb37a39b36df6fcd979f8caf84850769678ee8b5 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/1.in" @@ -0,0 +1,5 @@ +2 4 7 +2 3 4 +2 3 4 +1 2 3 +4 5 6 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/1.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/1.out" new file mode 100644 index 0000000000000000000000000000000000000000..e440e5c842586965a7fb77deda2eca68612b1f53 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/1.out" @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/10.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/10.in" new file mode 100644 index 0000000000000000000000000000000000000000..10a3a52b9a0f41ed4968480fa5679913b1aea28f --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/10.in" @@ -0,0 +1,3 @@ +1 2 3 +2 4 6 +3 4 9 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/10.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/10.out" new file mode 100644 index 0000000000000000000000000000000000000000..c227083464fb9af8955c90d2924774ee50abb547 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/10.out" @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/2.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/2.in" new file mode 100644 index 0000000000000000000000000000000000000000..ad4ae7e191d9a45d297a593ad3c106403f04a48f --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/2.in" @@ -0,0 +1,11 @@ +5 10 6 +1 2 3 +1 2 3 +1 2 3 +1 2 3 +1 2 3 +5 2 3 +2 3 4 +2 1 1 +2 3 4 +3 4 5 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/2.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/2.out" new file mode 100644 index 0000000000000000000000000000000000000000..6e827cd6db9145862ee7000c0837ff4d44e3f606 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/2.out" @@ -0,0 +1 @@ +1061109567 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/3.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/3.in" new file mode 100644 index 0000000000000000000000000000000000000000..3f91368c8da25f6d2d2eef3d692fcfe5b002a716 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/3.in" @@ -0,0 +1,4 @@ +3 3 40 +1 2 3 +2 3 4 +5 3 2 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/3.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/3.out" new file mode 100644 index 0000000000000000000000000000000000000000..c7930257dfef505fd996e1d6f22f2f35149990d0 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/3.out" @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/4.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/4.in" new file mode 100644 index 0000000000000000000000000000000000000000..f41f75cb22c7325b24a5059ee083e807d595577f --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/4.in" @@ -0,0 +1,4 @@ +3 3 40 +1 2 3 +2 3 3 +5 6 7 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/4.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/4.out" new file mode 100644 index 0000000000000000000000000000000000000000..62f9457511f879886bb7728c986fe10b0ece6bcb --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/4.out" @@ -0,0 +1 @@ +6 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/5.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/5.in" new file mode 100644 index 0000000000000000000000000000000000000000..151f8f10f8b6b59d92f87660dab8b9a3fdf01a9c --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/5.in" @@ -0,0 +1,4 @@ +2 4 30 +5 1 2 +5 2 2 +5 3 2 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/5.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/5.out" new file mode 100644 index 0000000000000000000000000000000000000000..c7930257dfef505fd996e1d6f22f2f35149990d0 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/5.out" @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/6.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/6.in" new file mode 100644 index 0000000000000000000000000000000000000000..b4d38edd2ba6abacc43c0f4a03a64ab4ca7079d4 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/6.in" @@ -0,0 +1,4 @@ +6 3 4 +2 1 4 +3 4 2 +1 2 1 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/6.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/6.out" new file mode 100644 index 0000000000000000000000000000000000000000..6e827cd6db9145862ee7000c0837ff4d44e3f606 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/6.out" @@ -0,0 +1 @@ +1061109567 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/7.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/7.in" new file mode 100644 index 0000000000000000000000000000000000000000..40caa2a2d73d0fa7c4358762a3681054199a3984 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/7.in" @@ -0,0 +1,7 @@ +3 6 5 +1 2 3 +2 3 6 +5 3 1 +5 1 2 +5 2 2 +5 2 2 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/7.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/7.out" new file mode 100644 index 0000000000000000000000000000000000000000..f11c82a4cb6cc2e8f3bdf52b5cdeaad4d5bb214e --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/7.out" @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/8.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/8.in" new file mode 100644 index 0000000000000000000000000000000000000000..e85bfb80f5125aa3326e07bcbe62ddc858761f0d --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/8.in" @@ -0,0 +1,4 @@ +1 3 5 +3 9 0 +2 4 0 +4 1 2 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/8.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/8.out" new file mode 100644 index 0000000000000000000000000000000000000000..c227083464fb9af8955c90d2924774ee50abb547 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/8.out" @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/9.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/9.in" new file mode 100644 index 0000000000000000000000000000000000000000..814d82981f2f3f9118a5769be7f7fdcd433ec82e --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/9.in" @@ -0,0 +1,3 @@ +2 2 5 +2 3 4 +1 2 3 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/9.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/9.out" new file mode 100644 index 0000000000000000000000000000000000000000..e440e5c842586965a7fb77deda2eca68612b1f53 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\344\270\255\347\255\211/\345\257\273\346\211\276\345\256\235\350\227\217\345\261\261/test_cases/9.out" @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/exercies.md" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/exercies.md" new file mode 100644 index 0000000000000000000000000000000000000000..f57e62dc994d4b3e8295ceeb0dd68e3f7fb0975d --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/exercies.md" @@ -0,0 +1,60 @@ +# 柯里昂家族树 + +在《教父》中,柯里昂家族是一个著名的黑手党家族,由家族的首领柯里昂(Don Corleone)和他的四个儿子构成。柯里昂家族的家谱是一棵二叉树,其中柯里昂是根节点,他的儿子们分别是他的左儿子和右儿子。 + +现在,你需要编写一个程序,读入一个包含若干行的字符串,每行表示一个人的信息。每行的格式如下: + +<人物名称> is the <父亲名称>'s <儿子> + +其中,人物名称是一个不包含空格的字符串,父亲名称和儿子也是一个不包含空格的字符串。 + +例如,下面是一棵柯里昂家族的家谱: + +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Michael Corleone is the Don's son +Tom Hagen is the Don's adopted son + +你的程序需要按照这些信息建立一棵二叉树,并输出这棵树的前序遍历。 + +例如,对于上面的家谱,输出应该是: + +Don Corleone Fredo Corleone Michael Corleone Tom Hagen + +你的程序需要支持以下功能: + + - 建立二叉树。你需要定义一个结构体表示一个节点,包含人物名称、左儿子和右儿子三个字段。你需要编写一个函数,读入若干行字符串,根据字符串中的信息建立二叉树。 + + - 输出前序遍历。你需要编写一个函数,输出给定二叉树的前序遍历。 +## 输入格式 +输入的第一行包含一个整数 n(1 <= n <= 1000),表示字符串的行数。 + +接下来的 n 行,每行包含一个字符串,表示一个人的信息。字符串的格式如上文所述。 + +## 输出格式 +输出给定二叉树的前序遍历,每个人物名称占一行。 + +## 输入样例 + +4 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Michael Corleone is the Don's son +Tom Hagen is the Don's adopted son + +## 输出样例 + +Don Corleone +Fredo Corleone +Michael Corleone +Tom Hagen + +## 提示 + +1. 人物名称和父亲名称均由不超过 100 个字符组成,且不包含空格; + +2. 儿子的值可能是 "son" 或 "adopted son"; + +3. 输入中可能会出现重名的人物,你的程序需要处理这种情况; + +4. 输入的字符串保证是合法的,不会出现父亲名称找不到的情况。 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/solution.cpp" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/solution.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..005cf61b91d12a9a0b4ead274bb4e2a687c44359 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/solution.cpp" @@ -0,0 +1,64 @@ +#include +#include + +using namespace std; + +//ṹʾһڵ +struct Node { + string name; + Node* left; + Node* right; +}; + +//ĺ +Node* build_tree(int n) { + // ڵ + string line; + getline(cin, line); + stringstream ss(line); + string name, is, the, father, s; + ss >> name >> is >> the >> father >> s; + Node* root = new Node{name, nullptr, nullptr}; + + // ʣĽڵ + for (int i = 1; i < n; i++) { + getline(cin, line); + stringstream ss(line); + string name, is, the, father, s; + ss >> name >> is >> the >> father >> s; + Node* cur = root; + while (true) { + if (father == cur->name && s == "son") { + if (cur->left == nullptr) { + cur->left = new Node{name, nullptr, nullptr}; + break; + } else if (cur->right == nullptr) { + cur->right = new Node{name, nullptr, nullptr}; + break; + } else { + cur = cur->left; + } + } else { + cur = cur->right; + } + } + } + return root; +} + +//ǰĺ +void preorder(Node* root) { + cout << root->name << " "; + if (root->left != nullptr) preorder(root->left); + if (root->right != nullptr) preorder(root->right); +} + +int main() { + int n; + cin >> n; + cin.ignore(); + Node* root = build_tree(n); + preorder(root); + return 0; +} + diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/1.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/1.in" new file mode 100644 index 0000000000000000000000000000000000000000..ac6a0c0def93197b2b32d3e6d84145bd49ce36e7 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/1.in" @@ -0,0 +1,6 @@ +5 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Michael Corleone is the Don's son +Tom Hagen is the Don's adopted son +Santino Corleone is the Michael's son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/1.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/1.out" new file mode 100644 index 0000000000000000000000000000000000000000..60c51997e58996d6c6617ad1411c0da00da450de --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/1.out" @@ -0,0 +1,5 @@ +Don Corleone +Fredo Corleone +Michael Corleone +Tom Hagen +Santino Corleone \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/10.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/10.in" new file mode 100644 index 0000000000000000000000000000000000000000..acdf41ba69cad5da6c062146cbc736c063af9fd6 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/10.in" @@ -0,0 +1,4 @@ +3 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Tom Hagen is the Fredo's son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/10.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/10.out" new file mode 100644 index 0000000000000000000000000000000000000000..1f3e5b7f356e360fb24ddbeec682fede489b336c --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/10.out" @@ -0,0 +1,3 @@ +Don Corleone +Fredo Corleone +Tom Hagen \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/2.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/2.in" new file mode 100644 index 0000000000000000000000000000000000000000..fa74f0f248d0ff084ec05748a137ce3532cfd410 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/2.in" @@ -0,0 +1,2 @@ +1 +Don Corleone is the Don's son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/2.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/2.out" new file mode 100644 index 0000000000000000000000000000000000000000..b3e2db4c1336504d8f31e45b2b0abd5734fe3786 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/2.out" @@ -0,0 +1 @@ +Don Corleone \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/3.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/3.in" new file mode 100644 index 0000000000000000000000000000000000000000..acdf41ba69cad5da6c062146cbc736c063af9fd6 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/3.in" @@ -0,0 +1,4 @@ +3 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Tom Hagen is the Fredo's son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/3.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/3.out" new file mode 100644 index 0000000000000000000000000000000000000000..1f3e5b7f356e360fb24ddbeec682fede489b336c --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/3.out" @@ -0,0 +1,3 @@ +Don Corleone +Fredo Corleone +Tom Hagen \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/4.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/4.in" new file mode 100644 index 0000000000000000000000000000000000000000..5844a400ca09eef3c6a5c51c6387e27365108b93 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/4.in" @@ -0,0 +1,4 @@ +3 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Tom Hagen is the Don's adopted son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/4.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/4.out" new file mode 100644 index 0000000000000000000000000000000000000000..1f3e5b7f356e360fb24ddbeec682fede489b336c --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/4.out" @@ -0,0 +1,3 @@ +Don Corleone +Fredo Corleone +Tom Hagen \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/5.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/5.in" new file mode 100644 index 0000000000000000000000000000000000000000..071bb79e7ede1d84e8441ad21268bb6ca4519af1 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/5.in" @@ -0,0 +1,3 @@ +2 +Don Corleone is the Don's son +Michael Corleone is the Don's son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/5.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/5.out" new file mode 100644 index 0000000000000000000000000000000000000000..69bdf14c6390f3be47a7e0c713242540ca05ac19 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/5.out" @@ -0,0 +1,2 @@ +Don Corleone +Michael Corleone \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/6.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/6.in" new file mode 100644 index 0000000000000000000000000000000000000000..1e33b3fee341e178e7f1d08c33e2e57854e62990 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/6.in" @@ -0,0 +1,3 @@ +2 +Don Corleone is the Don's son +Tom Hagen is the Don's adopted son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/6.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/6.out" new file mode 100644 index 0000000000000000000000000000000000000000..2df2059ef58a8a115d4cd73c7c206857327c7249 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/6.out" @@ -0,0 +1,2 @@ +Don Corleone +Tom Hagen \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/7.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/7.in" new file mode 100644 index 0000000000000000000000000000000000000000..5844a400ca09eef3c6a5c51c6387e27365108b93 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/7.in" @@ -0,0 +1,4 @@ +3 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Tom Hagen is the Don's adopted son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/7.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/7.out" new file mode 100644 index 0000000000000000000000000000000000000000..1f3e5b7f356e360fb24ddbeec682fede489b336c --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/7.out" @@ -0,0 +1,3 @@ +Don Corleone +Fredo Corleone +Tom Hagen \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/8.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/8.in" new file mode 100644 index 0000000000000000000000000000000000000000..c815d94df1d58418220911433c3781781ed1827f --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/8.in" @@ -0,0 +1,5 @@ +4 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Michael Corleone is the Don's son +Tom Hagen is the Don's adopted son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/8.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/8.out" new file mode 100644 index 0000000000000000000000000000000000000000..b5bfd970a79d66b407b1e7ac4057f129d52ec4ad --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/8.out" @@ -0,0 +1,4 @@ +Don Corleone +Fredo Corleone +Michael Corleone +Tom Hagen \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/9.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/9.in" new file mode 100644 index 0000000000000000000000000000000000000000..ac6a0c0def93197b2b32d3e6d84145bd49ce36e7 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/9.in" @@ -0,0 +1,6 @@ +5 +Don Corleone is the Don's son +Fredo Corleone is the Don's son +Michael Corleone is the Don's son +Tom Hagen is the Don's adopted son +Santino Corleone is the Michael's son \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/9.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/9.out" new file mode 100644 index 0000000000000000000000000000000000000000..60c51997e58996d6c6617ad1411c0da00da450de --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\345\233\260\351\232\276/\346\237\257\351\207\214\346\230\202\345\256\266\346\227\217\346\240\221/test_cases/9.out" @@ -0,0 +1,5 @@ +Don Corleone +Fredo Corleone +Michael Corleone +Tom Hagen +Santino Corleone \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/exercies.md" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/exercies.md" new file mode 100644 index 0000000000000000000000000000000000000000..7cb0adc650a2f4dc546f8fde449ee457e770221a --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/exercies.md" @@ -0,0 +1,33 @@ +# 山洞珍宝 + +在一端山路中,有一个神秘的山洞。这个山洞里有许多神奇的宝藏。 + +你在山洞外发现了一个奇怪的墙壁,上面有一个神秘的符号,你需要通过一定的方法来解码这个符号,只有解码这个符号后你才能进入这个山洞。 + +经过一番推导,你发现这个符号是一个由 0 和 1 组成的字符串,每个字符都有一个权值,分别是 $0,1,2,3,4,5,6,7,8,9$。 + +你需要从这个字符串中找到一个最大的子串,使得该子串的权值之和最大。 + +给定一个字符串 $S$,其长度不超过 $10^5$,且只包含字符 '0' 和 '1'。 + +请你找到字符串 $S$ 中权值和最大的子串。 + +## 输入描述 + +第一行包含一个字符串 $S$。 + +## 输出描述 + +输出一行,包含一个整数,表示最大的子串的权值和。 + +## 输入样例 + +0110100110110100 + +## 输出样例 + +35 + +## 提示 + +无 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/solution.cpp" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/solution.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..948df9369d6514c7bc0b6229026f06408f5f2c2b --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/solution.cpp" @@ -0,0 +1,30 @@ +#include +#include + +using namespace std; + +const int N = 1e5 + 10; + +int sum[N]; // sum[i] ʾַ s ǰ i ַȨֵ + +int main() { + string s; + cin >> s; + int n = s.size(); + + // Ȩֵ + for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + (s[i] - '0'); + + int ans = 0; + for (int i = 0; i < n; i++) { + for (int j = i + 1; j <= n; j++) { + // ַ s[i...j] Ȩֵ + int w = sum[j] - sum[i]; + ans = max(ans, w); + } + } + + cout << ans << endl; + + return 0; +} diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/1.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/1.in" new file mode 100644 index 0000000000000000000000000000000000000000..68e2fa29bfacbcc139e38477c701cfa72cd79f2b --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/1.in" @@ -0,0 +1 @@ +01010101010 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/1.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/1.out" new file mode 100644 index 0000000000000000000000000000000000000000..7813681f5b41c028345ca62a2be376bae70b7f61 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/1.out" @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/10.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/10.in" new file mode 100644 index 0000000000000000000000000000000000000000..77236107496301939623a2b2a58a250d69329fca --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/10.in" @@ -0,0 +1 @@ +100000000010000000001 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/10.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/10.out" new file mode 100644 index 0000000000000000000000000000000000000000..e440e5c842586965a7fb77deda2eca68612b1f53 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/10.out" @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/2.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/2.in" new file mode 100644 index 0000000000000000000000000000000000000000..9d9754475f8c0176d14b2579cade0018d50fd7d1 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/2.in" @@ -0,0 +1 @@ +111110000101010101101000011 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/2.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/2.out" new file mode 100644 index 0000000000000000000000000000000000000000..da2d3988d7d1a255376770b1e87394ebb42febb3 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/2.out" @@ -0,0 +1 @@ +14 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/3.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/3.in" new file mode 100644 index 0000000000000000000000000000000000000000..b6fc4d4f8cdd3095444eaa7174cecbcaaf9958a6 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/3.in" @@ -0,0 +1 @@ +1010101000001111010101001 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/3.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/3.out" new file mode 100644 index 0000000000000000000000000000000000000000..3cacc0b93c9c9c03a72da624ca28a09ba5c1336f --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/3.out" @@ -0,0 +1 @@ +12 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/4.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/4.in" new file mode 100644 index 0000000000000000000000000000000000000000..3d0071752a040f693e2c5ee7a5c0bedacdc6aebe --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/4.in" @@ -0,0 +1 @@ +111111100000000011010101001101 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/4.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/4.out" new file mode 100644 index 0000000000000000000000000000000000000000..3f10ffe7a4c473619c926cfb1e8d95e726e5a0ec --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/4.out" @@ -0,0 +1 @@ +15 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/5.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/5.in" new file mode 100644 index 0000000000000000000000000000000000000000..c5bac1f29f817bc0b5dda40be08d59ec386ac311 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/5.in" @@ -0,0 +1 @@ +11111110000000000 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/5.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/5.out" new file mode 100644 index 0000000000000000000000000000000000000000..c7930257dfef505fd996e1d6f22f2f35149990d0 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/5.out" @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/6.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/6.in" new file mode 100644 index 0000000000000000000000000000000000000000..c7e5538aa9abe9dad5bc158992718d280f4036e7 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/6.in" @@ -0,0 +1 @@ +10101010101001011111111 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/6.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/6.out" new file mode 100644 index 0000000000000000000000000000000000000000..3f10ffe7a4c473619c926cfb1e8d95e726e5a0ec --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/6.out" @@ -0,0 +1 @@ +15 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/7.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/7.in" new file mode 100644 index 0000000000000000000000000000000000000000..23a6e97a406a915fd863b61ee6b0bc7425f4fbea --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/7.in" @@ -0,0 +1 @@ +1111110010101010010 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/7.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/7.out" new file mode 100644 index 0000000000000000000000000000000000000000..9d607966b721abde8931ddd052181fae905db503 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/7.out" @@ -0,0 +1 @@ +11 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/8.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/8.in" new file mode 100644 index 0000000000000000000000000000000000000000..598a6bc452ea65a699ce2e1fc76480a4ab359b3a --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/8.in" @@ -0,0 +1 @@ +1111000001010101010 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/8.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/8.out" new file mode 100644 index 0000000000000000000000000000000000000000..f11c82a4cb6cc2e8f3bdf52b5cdeaad4d5bb214e --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/8.out" @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/9.in" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/9.in" new file mode 100644 index 0000000000000000000000000000000000000000..1295f59db31e9e3a38f26899fc5976a71b019e9b --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/9.in" @@ -0,0 +1 @@ +100101010100101010 \ No newline at end of file diff --git "a/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/9.out" "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/9.out" new file mode 100644 index 0000000000000000000000000000000000000000..301160a93062df23030a69f4b5e4d9bf71866ee9 --- /dev/null +++ "b/exercises/\347\224\237\344\272\247\351\230\237\347\232\204\345\210\230\345\220\214\345\255\246/\347\256\200\345\215\225/\345\261\261\346\264\236\347\217\215\345\256\235/test_cases/9.out" @@ -0,0 +1 @@ +8 \ No newline at end of file