From 4022e5c95210631e4aceb08eaf9d9071aa5aefc4 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Tue, 15 Sep 2026 08:16:43 +0800 Subject: Set up a git repo --- tests/upload/bigintadd.in | 2 + tests/upload/bigintadd.out | 2 + tests/upload/bigintadd.sy | 77 ++++ tests/upload/bigintsub.in | 2 + tests/upload/bigintsub.out | 2 + tests/upload/bigintsub.sy | 127 +++++++ tests/upload/bin_search.in | 15 + tests/upload/bin_search.out | 15 + tests/upload/bin_search.sy | 110 ++++++ tests/upload/binary_search2.in | 2 + tests/upload/binary_search2.out | 2 + tests/upload/binary_search2.sy | 30 ++ tests/upload/bubble_sort.in | 1 + tests/upload/bubble_sort.out | 2 + tests/upload/bubble_sort.sy | 51 +++ tests/upload/decbinoct.in | 1 + tests/upload/decbinoct.out | 2 + tests/upload/decbinoct.sy | 50 +++ tests/upload/digui1.in | 4 + tests/upload/digui1.out | 4 + tests/upload/digui1.sy | 58 +++ tests/upload/digui2.in | 3 + tests/upload/digui2.out | 123 ++++++ tests/upload/digui2.sy | 42 +++ tests/upload/digui3.in | 2 + tests/upload/digui3.out | 4 + tests/upload/digui3.sy | 91 +++++ tests/upload/flower.in | 1 + tests/upload/flower.out | 47 +++ tests/upload/flower.sy | 137 +++++++ tests/upload/full_permutation.in | 1 + tests/upload/full_permutation.out | 721 ++++++++++++++++++++++++++++++++++++ tests/upload/full_permutation.sy | 45 +++ tests/upload/gcd.in | 6 + tests/upload/gcd.out | 11 + tests/upload/gcd.sy | 42 +++ tests/upload/gcd_iterative.in | 1 + tests/upload/gcd_iterative.out | 1 + tests/upload/gcd_iterative.sy | 17 + tests/upload/gcd_recursive.in | 1 + tests/upload/gcd_recursive.out | 1 + tests/upload/gcd_recursive.sy | 17 + tests/upload/heap_sort.in | 11 + tests/upload/heap_sort.out | 2 + tests/upload/heap_sort.sy | 63 ++++ tests/upload/insert_sort.in | 11 + tests/upload/insert_sort.out | 2 + tests/upload/insert_sort.sy | 37 ++ tests/upload/line_search.in | 1 + tests/upload/line_search.out | 4 + tests/upload/line_search.sy | 54 +++ tests/upload/ls.in | 3 + tests/upload/ls.out | 2 + tests/upload/ls.sy | 22 ++ tests/upload/many_local_var.out | 2 + tests/upload/many_local_var.sy | 167 +++++++++ tests/upload/many_param.out | 2 + tests/upload/many_param.sy | 10 + tests/upload/matrix-1.in | 11 + tests/upload/matrix-1.out | 12 + tests/upload/matrix-1.sy | 309 ++++++++++++++++ tests/upload/matrix-1_2.in | 5 + tests/upload/matrix-1_2.out | 6 + tests/upload/matrix-1_2.sy | 309 ++++++++++++++++ tests/upload/matrix_det_1.in | 11 + tests/upload/matrix_det_1.out | 12 + tests/upload/matrix_det_1.sy | 128 +++++++ tests/upload/matrix_det_2.in | 16 + tests/upload/matrix_det_2.out | 12 + tests/upload/matrix_det_2.sy | 128 +++++++ tests/upload/matrix_matrix.in | 6 + tests/upload/matrix_matrix.out | 3 + tests/upload/matrix_matrix.sy | 58 +++ tests/upload/matrix_rank_1.in | 201 ++++++++++ tests/upload/matrix_rank_1.out | 402 ++++++++++++++++++++ tests/upload/matrix_rank_1.sy | 197 ++++++++++ tests/upload/matrix_rank_2.in | 11 + tests/upload/matrix_rank_2.out | 22 ++ tests/upload/matrix_rank_2.sy | 197 ++++++++++ tests/upload/matrix_tran.out | 8 + tests/upload/matrix_tran.sy | 46 +++ tests/upload/matrix_vector.in | 4 + tests/upload/matrix_vector.out | 2 + tests/upload/matrix_vector.sy | 34 ++ tests/upload/merge_sort.in | 1 + tests/upload/merge_sort.out | 2 + tests/upload/merge_sort.sy | 77 ++++ tests/upload/merge_sort_xunhuan.in | 11 + tests/upload/merge_sort_xunhuan.out | 2 + tests/upload/merge_sort_xunhuan.sy | 88 +++++ tests/upload/quick_sort.in | 1 + tests/upload/quick_sort.out | 2 + tests/upload/quick_sort.sy | 75 ++++ tests/upload/select_sort.in | 1 + tests/upload/select_sort.out | 2 + tests/upload/select_sort.sy | 56 +++ tests/upload/shell_sort.in | 11 + tests/upload/shell_sort.out | 2 + tests/upload/shell_sort.sy | 61 +++ tests/upload/test1_1.in | 1 + tests/upload/test1_1.out | 2 + tests/upload/test1_1.sy | 105 ++++++ tests/upload/test1_2.in | 1 + tests/upload/test1_2.out | 2 + tests/upload/test1_2.sy | 105 ++++++ tests/upload/test2_1.in | 51 +++ tests/upload/test2_1.out | 2 + tests/upload/test2_1.sy | 59 +++ tests/upload/test2_2.in | 31 ++ tests/upload/test2_2.out | 2 + tests/upload/test2_2.sy | 59 +++ tests/upload/test3_1.in | 2 + tests/upload/test3_1.out | 3 + tests/upload/test3_1.sy | 64 ++++ tests/upload/test3_2.in | 2 + tests/upload/test3_2.out | 3 + tests/upload/test3_2.sy | 64 ++++ tests/upload/test4_1.in | 2 + tests/upload/test4_1.out | 2 + tests/upload/test4_1.sy | 69 ++++ tests/upload/test5_1.in | 73 ++++ tests/upload/test5_1.out | 2 + tests/upload/test5_1.sy | 40 ++ tests/upload/test5_2.in | 73 ++++ tests/upload/test5_2.out | 2 + tests/upload/test5_2.sy | 40 ++ tests/upload/test_array.in | 24 ++ tests/upload/test_array.out | 2 + tests/upload/test_array.sy | 163 ++++++++ tests/upload/testcase.in | 1 + tests/upload/testcase.out | 2 + tests/upload/testcase.sy | 104 ++++++ 132 files changed, 5965 insertions(+) create mode 100755 tests/upload/bigintadd.in create mode 100755 tests/upload/bigintadd.out create mode 100755 tests/upload/bigintadd.sy create mode 100755 tests/upload/bigintsub.in create mode 100755 tests/upload/bigintsub.out create mode 100644 tests/upload/bigintsub.sy create mode 100644 tests/upload/bin_search.in create mode 100644 tests/upload/bin_search.out create mode 100644 tests/upload/bin_search.sy create mode 100644 tests/upload/binary_search2.in create mode 100644 tests/upload/binary_search2.out create mode 100644 tests/upload/binary_search2.sy create mode 100755 tests/upload/bubble_sort.in create mode 100755 tests/upload/bubble_sort.out create mode 100755 tests/upload/bubble_sort.sy create mode 100644 tests/upload/decbinoct.in create mode 100644 tests/upload/decbinoct.out create mode 100644 tests/upload/decbinoct.sy create mode 100644 tests/upload/digui1.in create mode 100644 tests/upload/digui1.out create mode 100644 tests/upload/digui1.sy create mode 100644 tests/upload/digui2.in create mode 100644 tests/upload/digui2.out create mode 100644 tests/upload/digui2.sy create mode 100644 tests/upload/digui3.in create mode 100644 tests/upload/digui3.out create mode 100644 tests/upload/digui3.sy create mode 100644 tests/upload/flower.in create mode 100644 tests/upload/flower.out create mode 100644 tests/upload/flower.sy create mode 100755 tests/upload/full_permutation.in create mode 100755 tests/upload/full_permutation.out create mode 100755 tests/upload/full_permutation.sy create mode 100644 tests/upload/gcd.in create mode 100644 tests/upload/gcd.out create mode 100644 tests/upload/gcd.sy create mode 100644 tests/upload/gcd_iterative.in create mode 100644 tests/upload/gcd_iterative.out create mode 100644 tests/upload/gcd_iterative.sy create mode 100644 tests/upload/gcd_recursive.in create mode 100644 tests/upload/gcd_recursive.out create mode 100644 tests/upload/gcd_recursive.sy create mode 100644 tests/upload/heap_sort.in create mode 100644 tests/upload/heap_sort.out create mode 100644 tests/upload/heap_sort.sy create mode 100644 tests/upload/insert_sort.in create mode 100644 tests/upload/insert_sort.out create mode 100644 tests/upload/insert_sort.sy create mode 100644 tests/upload/line_search.in create mode 100644 tests/upload/line_search.out create mode 100644 tests/upload/line_search.sy create mode 100644 tests/upload/ls.in create mode 100644 tests/upload/ls.out create mode 100644 tests/upload/ls.sy create mode 100644 tests/upload/many_local_var.out create mode 100644 tests/upload/many_local_var.sy create mode 100644 tests/upload/many_param.out create mode 100644 tests/upload/many_param.sy create mode 100644 tests/upload/matrix-1.in create mode 100644 tests/upload/matrix-1.out create mode 100644 tests/upload/matrix-1.sy create mode 100644 tests/upload/matrix-1_2.in create mode 100644 tests/upload/matrix-1_2.out create mode 100644 tests/upload/matrix-1_2.sy create mode 100644 tests/upload/matrix_det_1.in create mode 100644 tests/upload/matrix_det_1.out create mode 100644 tests/upload/matrix_det_1.sy create mode 100644 tests/upload/matrix_det_2.in create mode 100644 tests/upload/matrix_det_2.out create mode 100644 tests/upload/matrix_det_2.sy create mode 100755 tests/upload/matrix_matrix.in create mode 100755 tests/upload/matrix_matrix.out create mode 100755 tests/upload/matrix_matrix.sy create mode 100644 tests/upload/matrix_rank_1.in create mode 100644 tests/upload/matrix_rank_1.out create mode 100644 tests/upload/matrix_rank_1.sy create mode 100644 tests/upload/matrix_rank_2.in create mode 100644 tests/upload/matrix_rank_2.out create mode 100644 tests/upload/matrix_rank_2.sy create mode 100644 tests/upload/matrix_tran.out create mode 100644 tests/upload/matrix_tran.sy create mode 100755 tests/upload/matrix_vector.in create mode 100755 tests/upload/matrix_vector.out create mode 100755 tests/upload/matrix_vector.sy create mode 100755 tests/upload/merge_sort.in create mode 100755 tests/upload/merge_sort.out create mode 100755 tests/upload/merge_sort.sy create mode 100644 tests/upload/merge_sort_xunhuan.in create mode 100644 tests/upload/merge_sort_xunhuan.out create mode 100644 tests/upload/merge_sort_xunhuan.sy create mode 100755 tests/upload/quick_sort.in create mode 100755 tests/upload/quick_sort.out create mode 100755 tests/upload/quick_sort.sy create mode 100755 tests/upload/select_sort.in create mode 100755 tests/upload/select_sort.out create mode 100755 tests/upload/select_sort.sy create mode 100644 tests/upload/shell_sort.in create mode 100644 tests/upload/shell_sort.out create mode 100644 tests/upload/shell_sort.sy create mode 100644 tests/upload/test1_1.in create mode 100644 tests/upload/test1_1.out create mode 100644 tests/upload/test1_1.sy create mode 100644 tests/upload/test1_2.in create mode 100644 tests/upload/test1_2.out create mode 100644 tests/upload/test1_2.sy create mode 100644 tests/upload/test2_1.in create mode 100644 tests/upload/test2_1.out create mode 100644 tests/upload/test2_1.sy create mode 100644 tests/upload/test2_2.in create mode 100644 tests/upload/test2_2.out create mode 100644 tests/upload/test2_2.sy create mode 100644 tests/upload/test3_1.in create mode 100644 tests/upload/test3_1.out create mode 100644 tests/upload/test3_1.sy create mode 100644 tests/upload/test3_2.in create mode 100644 tests/upload/test3_2.out create mode 100644 tests/upload/test3_2.sy create mode 100644 tests/upload/test4_1.in create mode 100644 tests/upload/test4_1.out create mode 100644 tests/upload/test4_1.sy create mode 100644 tests/upload/test5_1.in create mode 100644 tests/upload/test5_1.out create mode 100644 tests/upload/test5_1.sy create mode 100644 tests/upload/test5_2.in create mode 100644 tests/upload/test5_2.out create mode 100644 tests/upload/test5_2.sy create mode 100644 tests/upload/test_array.in create mode 100644 tests/upload/test_array.out create mode 100644 tests/upload/test_array.sy create mode 100644 tests/upload/testcase.in create mode 100644 tests/upload/testcase.out create mode 100644 tests/upload/testcase.sy (limited to 'tests/upload') diff --git a/tests/upload/bigintadd.in b/tests/upload/bigintadd.in new file mode 100755 index 0000000..bff6bb4 --- /dev/null +++ b/tests/upload/bigintadd.in @@ -0,0 +1,2 @@ +50 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 +51 9 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 \ No newline at end of file diff --git a/tests/upload/bigintadd.out b/tests/upload/bigintadd.out new file mode 100755 index 0000000..32cc8bd --- /dev/null +++ b/tests/upload/bigintadd.out @@ -0,0 +1,2 @@ +1009877543110987754311098775431109877543110987754310 +0 \ No newline at end of file diff --git a/tests/upload/bigintadd.sy b/tests/upload/bigintadd.sy new file mode 100755 index 0000000..3dfac88 --- /dev/null +++ b/tests/upload/bigintadd.sy @@ -0,0 +1,77 @@ + +int BigIntarr[2][100]; +int BigIntLength[2]; +int Result[200]; + +int min(int a, int b) { + if (a > b) { + return b; + } + else { + return a; + } +} + +int add() { + int a[100];//加数 + int b[100];//被加数 + int c[100] = { 0 };//和 + int i, j = 0, k;//i用来循环,j表示进位 ,两加数中较小加数的长度放到k里 + int l1, l2, d; + l1 = BigIntLength[0]; + l2 = BigIntLength[1]; + k = min(l1, l2); + i = 0; + while (i < BigIntLength[0]) { + a[i] = BigIntarr[0][l1 - 1 - i]; + i = i + 1; + } + i = 0; + while (i < BigIntLength[1]) { + b[i] = BigIntarr[1][l2 - 1 - i]; + i = i + 1; + } + i = 0; + while(i 0) { c[i] = j; i=i+1; } + j = 0; + k = i - 1; + while (k > -1) { + Result[j] = c[k]; + k = k - 1; + j = j + 1; + } + return j; +} + +int main() +{ + int n; + int i = 0; + BigIntLength[0] = getarray(BigIntarr[0]); + BigIntLength[1] = getarray(BigIntarr[1]); + n = add(); + i = 0; + while (i < n) { + putint(Result[i]); + i = i + 1; + } + return 0; +} \ No newline at end of file diff --git a/tests/upload/bigintsub.in b/tests/upload/bigintsub.in new file mode 100755 index 0000000..8551956 --- /dev/null +++ b/tests/upload/bigintsub.in @@ -0,0 +1,2 @@ +52 1 0 0 9 8 7 7 5 4 3 1 1 0 9 8 7 7 5 4 3 1 1 0 9 8 7 7 5 4 3 1 1 0 9 8 7 7 5 4 3 1 1 0 9 8 7 7 5 4 3 1 0 +51 9 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 9 7 5 3 1 8 6 4 2 0 \ No newline at end of file diff --git a/tests/upload/bigintsub.out b/tests/upload/bigintsub.out new file mode 100755 index 0000000..503c16a --- /dev/null +++ b/tests/upload/bigintsub.out @@ -0,0 +1,2 @@ +12345678901234567890123456789012345678901234567890 +0 \ No newline at end of file diff --git a/tests/upload/bigintsub.sy b/tests/upload/bigintsub.sy new file mode 100644 index 0000000..0c5e915 --- /dev/null +++ b/tests/upload/bigintsub.sy @@ -0,0 +1,127 @@ +int BigIntarr[2][100]; +int BigIntLength[2]; +int Result[200]; + +int min(int a, int b) { + if (a > b) { + return b; + } + else { + return a; + } +} + +int max(int a, int b) { + if (a > b) { + return a; + } + else { + return b; + } +} + +int compare() { + int i = 0; + if (BigIntLength[0] > BigIntLength[1]) { + return 1; + } + if (BigIntLength[0] < BigIntLength[1]) { + return -1; + } + while (i < BigIntLength[0]) { + if (BigIntarr[0][i] > BigIntarr[1][i]) { + return 1; + } + if (BigIntarr[0][i] < BigIntarr[1][i]){ + return -1; + } + i = i + 1; + } + return 0; +} + +int subtract() { + int a[100];//把较大的数放于减数 + int b[100];//把较小的数放于被减数 + int c[100] = { 0 };//差 + int i, j, k;//i用来循环 ,两加数中较大加数的长度放到j里,两加数中较小加数的长度放到k里 + int flag;//标志结果为正还是负。 + int l1, l2; + int pp[100]; + l1 = BigIntLength[0]; + l2 = BigIntLength[1]; + k = min(l1, l2); + j = max(l1, l2); + if (compare() >= 0) {//减数必须大于被减数。方便计算。如果小于,就调换位置。 + flag = 0; + i = 0; + while (i < l1) { //字符串逆序导入数组中 + a[i] = BigIntarr[0][l1 - 1 - i]; + i = i + 1; + } + i = 0; + while (i < l2) { + b[i] = BigIntarr[1][l2 - 1 - i]; + i = i + 1; + } + } + else { + flag = 1; + i = 0; + while (i < l2) { + a[i] = BigIntarr[1][l2 - 1 - i]; + i = i + 1; + } + i = 0; + while (i < l1) { + b[i] = BigIntarr[0][l1 - 1 - i]; + i = i + 1; + } + } + i = 0; + while (i < k) { + if (a[i] >= b[i]) { + c[i] = a[i] - b[i]; + } + else { + c[i] = a[i] + 10 - b[i]; + a[i + 1] = a[i + 1] - 1; + } + i = i + 1; + } + while (i < j) { + if (a[i] >= 0) { c[i] = a[i]; } + else { + c[i] = a[i] + 10; + a[i + 1] = a[i + 1] - 1; + } + i = i + 1; + } + while (c[i - 1] == 0) i = i - 1; + j = 0; + if (flag == 1) + //pp[j++] = '-'; + putch(45); + k = i - 1; + while (k > -1) { + Result[j] = c[k]; + k = k - 1; + j = j + 1; + } + return j; +} + +int main() +{ + int n; + int i = 0; + BigIntLength[0] = getarray(BigIntarr[0]); + BigIntLength[1] = getarray(BigIntarr[1]); + i = 0; + n = subtract(); + while (i < n) { + putint(Result[i]); + i = i + 1; + } + return 0; +} \ No newline at end of file diff --git a/tests/upload/bin_search.in b/tests/upload/bin_search.in new file mode 100644 index 0000000..ddb02ac --- /dev/null +++ b/tests/upload/bin_search.in @@ -0,0 +1,15 @@ +12 985 741 -963 1000 4523 2 0 -324 888 -65 418 2486 +0 0 +0 100 +0 2 +0 60 +0 50 +0 8 +0 45 +1 2486 +1 0 +1 999 +1 666 +1 888 +1 -963 +-1 \ No newline at end of file diff --git a/tests/upload/bin_search.out b/tests/upload/bin_search.out new file mode 100644 index 0000000..5c9ee94 --- /dev/null +++ b/tests/upload/bin_search.out @@ -0,0 +1,15 @@ +12: -963 -324 -65 0 2 418 741 888 985 1000 2486 4523 +-1 +-1 +0 +22 +12 +5 +7 +10 +3 +-1 +-1 +7 +0 +0 \ No newline at end of file diff --git a/tests/upload/bin_search.sy b/tests/upload/bin_search.sy new file mode 100644 index 0000000..eeb1588 --- /dev/null +++ b/tests/upload/bin_search.sy @@ -0,0 +1,110 @@ +void QuickSort(int arr[], int low, int high) +{ + if (low < high) + { + int i = low; + int j = high; + int k = arr[low]; + while (i < j) + { + while(i < j && arr[j] >= k) + { + j=j-1; + } + if(i < j) + { + arr[i] = arr[j]; + i=i+1; + } + while(i < j && arr[i] < k) + { + i=i+1; + } + if(i < j) + { + arr[j] = arr[i]; + j=j-1; + } + } + arr[i] = k; + QuickSort(arr, low, i - 1); + QuickSort(arr, i + 1, high); + } +} + + + +int find(int n,int a[],int l) +{ + int low=0; + int high=l-1; + int middle=0; + while(low<=high) + { + middle=(low+high)/2; + if(n==a[middle]) + { + return middle; + } + else + { + if(n>a[middle]) + low=middle+1; + else + high=middle-1; + } + } + return -1; +} + +int fun(int arr[], int start, int end, int val) +{ + int mid; + mid = (start + end) / 2; + + if (arr[mid] == val) + return mid; + if (start < end) + { + if (arr[mid] > val) + return fun(arr, start, mid, val); + else + return fun(arr, mid + 1, end, val); + } + else + return -1; +} + +int main(){ + int a[23]={2,3,5,6,7,8,9,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60}; + int b[100]; + int l1=23; + int i=0,n; + + int l2=getarray(b); + QuickSort(b,0,l2-1); + putarray(l2,b); + putch(10); + int op=getint(); + while(op!=-1){ + n=getint(); + if(op==0){ + int x=find(n,a,l1); + int y=fun(a,0,l1-1,n); + if(x!=y){ + return -1; + } + putint(x); + }else{ + int x=find(n,b,l2); + int y=fun(b,0,l2-1,n); + if(x!=y){ + return -1; + } + putint(x); + } + putch(10); + op=getint(); + } + return 0; +} \ No newline at end of file diff --git a/tests/upload/binary_search2.in b/tests/upload/binary_search2.in new file mode 100644 index 0000000..1db6dc4 --- /dev/null +++ b/tests/upload/binary_search2.in @@ -0,0 +1,2 @@ +10 1 3 5 7 9 10 11 12 13 14 +3 \ No newline at end of file diff --git a/tests/upload/binary_search2.out b/tests/upload/binary_search2.out new file mode 100644 index 0000000..166c057 --- /dev/null +++ b/tests/upload/binary_search2.out @@ -0,0 +1,2 @@ +1 +0 \ No newline at end of file diff --git a/tests/upload/binary_search2.sy b/tests/upload/binary_search2.sy new file mode 100644 index 0000000..9134622 --- /dev/null +++ b/tests/upload/binary_search2.sy @@ -0,0 +1,30 @@ +int fun(int arr[], int start, int end, int val) +{ + int mid; + mid = (start + end) / 2; + + if (arr[mid] == val) + return mid; + if (start < end) + { + if (arr[mid] > val) + return fun(arr, start, mid, val); + else + return fun(arr, mid + 1, end, val); + } + else + return -1; +} +int main() +{ + int arr[10]; + int val; + int left; + int right; + int i = 0; + right = getarray(arr); + right = right - 1; + val=getint(); + putint(fun(arr, 0, right, val)); + return 0; +} diff --git a/tests/upload/bubble_sort.in b/tests/upload/bubble_sort.in new file mode 100755 index 0000000..549004f --- /dev/null +++ b/tests/upload/bubble_sort.in @@ -0,0 +1 @@ +4 1 221 521 25 \ No newline at end of file diff --git a/tests/upload/bubble_sort.out b/tests/upload/bubble_sort.out new file mode 100755 index 0000000..5a25c42 --- /dev/null +++ b/tests/upload/bubble_sort.out @@ -0,0 +1,2 @@ +1 25 221 521 +0 \ No newline at end of file diff --git a/tests/upload/bubble_sort.sy b/tests/upload/bubble_sort.sy new file mode 100755 index 0000000..2aae5d6 --- /dev/null +++ b/tests/upload/bubble_sort.sy @@ -0,0 +1,51 @@ +int arr[100]; + +void bubbleSort(int n) +{ + int i = 0; + int j = 0; + int tmp; + + while (i < n - 1) + { + j = 1; + while (j < n) + { + if (arr[j] < arr[j - 1]) + { + tmp = arr[j]; + arr[j] = arr[j - 1]; + arr[j - 1] = tmp; + } + j = j + 1; + } + i = i + 1; + } +} + +void printArray(int n) +{ + int i = 0; + while (i < n) + { + putint(arr[i]); + putch(32); + // printf("%d ", arr[i]); + i = i + 1; + } +} + +int main() +{ + int n; + int i = 0; + n = getint(); + while (i < n) + { + arr[i] = getint(); + i = i + 1; + } + bubbleSort(n); + printArray(n); + return 0; +} \ No newline at end of file diff --git a/tests/upload/decbinoct.in b/tests/upload/decbinoct.in new file mode 100644 index 0000000..a21b2af --- /dev/null +++ b/tests/upload/decbinoct.in @@ -0,0 +1 @@ +125594745 diff --git a/tests/upload/decbinoct.out b/tests/upload/decbinoct.out new file mode 100644 index 0000000..192ab4f --- /dev/null +++ b/tests/upload/decbinoct.out @@ -0,0 +1,2 @@ +111011111000110110001111001 737066171 77C6C79 +0 diff --git a/tests/upload/decbinoct.sy b/tests/upload/decbinoct.sy new file mode 100644 index 0000000..8f89adf --- /dev/null +++ b/tests/upload/decbinoct.sy @@ -0,0 +1,50 @@ +int main(){ + int n = getint(); + int nb = n; + int no = n; + int nh = n; + int binlen = 0; + int octlen = 0; + int hexlen = 0; + int bin[32]={}; + int oct[32]={}; + int hex[32]={}; + while(nb > 0){ + int bd = nb % 2; + bin[binlen] = bd; + binlen = binlen + 1; + nb = nb / 2; + } + while(binlen > 0){ + binlen = binlen - 1; + putint(bin[binlen]); + } + putch(32); + while(no > 0){ + int od = no % 8; + oct[octlen] = od; + octlen = octlen + 1; + no = no / 8; + } + while(octlen > 0){ + octlen = octlen - 1; + putint(oct[octlen]); + } + putch(32); + while(nh > 0){ + int hd = nh % 16; + hex[hexlen] = hd; + hexlen = hexlen + 1; + nh = nh / 16; + } + while(hexlen > 0){ + hexlen = hexlen - 1; + int hd = hex[hexlen]; + if(hd < 10){ + putch(hd+48); + }else{ + putch(hd-10+65); + } + } + return 0; +} diff --git a/tests/upload/digui1.in b/tests/upload/digui1.in new file mode 100644 index 0000000..6d13d3d --- /dev/null +++ b/tests/upload/digui1.in @@ -0,0 +1,4 @@ +3 +5 +6 +7 \ No newline at end of file diff --git a/tests/upload/digui1.out b/tests/upload/digui1.out new file mode 100644 index 0000000..8f46094 --- /dev/null +++ b/tests/upload/digui1.out @@ -0,0 +1,4 @@ +24683175 +25713864 +25741863 +0 \ No newline at end of file diff --git a/tests/upload/digui1.sy b/tests/upload/digui1.sy new file mode 100644 index 0000000..c621d50 --- /dev/null +++ b/tests/upload/digui1.sy @@ -0,0 +1,58 @@ +int N; +int a[100]; +int out[100][10]; +int cnt; + +void NQueen(int k) +{ + int i; + int j; + if(k==N) { + cnt = cnt+1; + i = 0; + while (i < N) { + out[cnt][i]=a[i]+1; + i = i + 1; + } + return; + } + i = 0; + while(in-1(实际是1->n)这些数 v[i]标志这个数是否被访问过 + if(v[i]==1) { + i = i+1; + continue; + } + v[i]=1; + a[p]=i;//p代表位置 每次给一个位置找值 + DFS(p+1); + v[i]=0;//回溯 + i = i+1; + } +} + +int main() +{ + int i; + while(1){ + n = getint(); + if(n==0) { + break; + } + i=0; + while (i<10){ + v[i]=0; + i=i+1; + } + DFS(0); + } + return 0; +} diff --git a/tests/upload/digui3.in b/tests/upload/digui3.in new file mode 100644 index 0000000..80b7a97 --- /dev/null +++ b/tests/upload/digui3.in @@ -0,0 +1,2 @@ +50 +10 diff --git a/tests/upload/digui3.out b/tests/upload/digui3.out new file mode 100644 index 0000000..207b36c --- /dev/null +++ b/tests/upload/digui3.out @@ -0,0 +1,4 @@ +16928 +3658 +3658 +0 \ No newline at end of file diff --git a/tests/upload/digui3.sy b/tests/upload/digui3.sy new file mode 100644 index 0000000..bdac931 --- /dev/null +++ b/tests/upload/digui3.sy @@ -0,0 +1,91 @@ +int n; +int k; +int cnt; +int a[60]; + +void solve1(int p,int sum,int last) +{ + int i; + if(sum==n){ + if(p==k){ + cnt = cnt+1; + } + return; + } + if(sum>n){ + return; + } + i=last; + while(i>=1){ + a[p]=i; + sum=sum+i; + solve1(p+1,sum,i); + sum=sum-i; + i=i-1; + } +} + +void solve2(int p,int sum,int last) +{ + int i; + if(sum==n){ + cnt = cnt+1; + return; + } + if(sum>n){ + return; + } + i=last; + while(i>=1){ + a[p]=i; + sum=sum+i; + solve2(p+1,sum,i-1); + sum=sum-i; + i=i-1; + } +} + +void solve3(int p,int sum,int last) +{ + int i; + if(sum==n){ + cnt = cnt+1; + return; + } + if(sum>n){ + return; + } + i=last; + while(i>=1){ + a[p]=i; + sum=sum+i; + solve3(p+1,sum,i); + sum=sum-i; + i=i-2; + } +} + +int main() +{ + n = getint(); + k = getint(); + cnt=0; + solve1(0,0,n); + putint(cnt); + putch(10); + cnt=0; + solve2(0,0,n); + putint(cnt); + putch(10); + cnt=0; + if(n%2==0) { + solve3(0,0,n-1); + } + else { + solve3(0,0,n); + } + putint(cnt); + putch(10); + + return 0; +} diff --git a/tests/upload/flower.in b/tests/upload/flower.in new file mode 100644 index 0000000..aeb00c9 --- /dev/null +++ b/tests/upload/flower.in @@ -0,0 +1 @@ +31 31 \ No newline at end of file diff --git a/tests/upload/flower.out b/tests/upload/flower.out new file mode 100644 index 0000000..17bd749 --- /dev/null +++ b/tests/upload/flower.out @@ -0,0 +1,47 @@ +738197504 +31 62 +62 31 +6 +1 +2 +3 +28 +1 +2 +4 +7 +14 +153 +2 +3 +5 +7 +11 +13 +17 +19 +23 +29 +31 +37 +41 +43 +47 +53 +59 +61 +67 +71 +73 +79 +83 +89 +97 +101 +103 +107 +109 +113 +127 +31 +0 \ No newline at end of file diff --git a/tests/upload/flower.sy b/tests/upload/flower.sy new file mode 100644 index 0000000..b46240d --- /dev/null +++ b/tests/upload/flower.sy @@ -0,0 +1,137 @@ +const int MAXNUM = 128 ; + +int factorial(int n){ + if(n<=1) return (1); + return(n*factorial(n-1)) ; +} + +int mod(int x, int y){ + x=x-x/y*y; + + return (x) ; +} + +void swap(int x, int y){ + int temp; + + putint(x); + putch(32); + putint(y); + putch(10); + temp = x; + x=y; + y=temp; + putint(x); + putch(32); + putint(y); + putch(10); +} + +int fullnum(int n, int j, int a){ + return (n*100+j*10+a) ; +} + +int flowernum(int n, int j, int a){ + return (n*n*n+j*j*j+a*a*a) ; +} + +void completeflowernum() +{ + int k[128]; + int i,j,n,s,x1,y; + int m,k2,h,leap,x2; + int a,b,c ; + + j = 2; + while (j < MAXNUM) { + n = -1; + s = j; + i = 1; + while(i= 128) + putint(-1); + else + k[n] = i; + } + i = i + 1; + } + if(s==0) { + putint(j); + putch(10); + i = 0; + while(i <= n) { + putint(k[i]); + putch(10); + i = i + 1; + } + } + j = j + 1; + } + + y = 0 ; + i = 100; + while (i < 100+MAXNUM) { + n=i/100; + j=mod(i/10,10); + a=mod(i,10); + if(fullnum(n,j,a)==flowernum(n, j, a)){ + k[y] = i ; + y = y + 1 ; + } + i = i + 1; + } + i = 0; + while(i0){ + int m=getint(); + int n=getint(); + int t1=gcd1(m,n); + int t2=gcd2(m,n); + putint(t1); + putch(10); + putint(t2); + putch(10); + num=num-1; + } + + return 0; +} \ No newline at end of file diff --git a/tests/upload/gcd_iterative.in b/tests/upload/gcd_iterative.in new file mode 100644 index 0000000..9d23f62 --- /dev/null +++ b/tests/upload/gcd_iterative.in @@ -0,0 +1 @@ +8778 50830 diff --git a/tests/upload/gcd_iterative.out b/tests/upload/gcd_iterative.out new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tests/upload/gcd_iterative.out @@ -0,0 +1 @@ +2 diff --git a/tests/upload/gcd_iterative.sy b/tests/upload/gcd_iterative.sy new file mode 100644 index 0000000..3ed22db --- /dev/null +++ b/tests/upload/gcd_iterative.sy @@ -0,0 +1,17 @@ +int gcd(int a, int b){ + while(a != 0 && b != 0){ + if(a > b) a = a % b; + else b = b % a; + } + if(a != 0) return a; + else return b; +} + +int main(){ + int a, b; + int c; + a = getint(); + b = getint(); + c = gcd(a, b); + return c; +} diff --git a/tests/upload/gcd_recursive.in b/tests/upload/gcd_recursive.in new file mode 100644 index 0000000..9d23f62 --- /dev/null +++ b/tests/upload/gcd_recursive.in @@ -0,0 +1 @@ +8778 50830 diff --git a/tests/upload/gcd_recursive.out b/tests/upload/gcd_recursive.out new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tests/upload/gcd_recursive.out @@ -0,0 +1 @@ +2 diff --git a/tests/upload/gcd_recursive.sy b/tests/upload/gcd_recursive.sy new file mode 100644 index 0000000..fd09019 --- /dev/null +++ b/tests/upload/gcd_recursive.sy @@ -0,0 +1,17 @@ +int gcd(int a, int b){ + if(a == 0) return b; + if(b == 0) return a; + if(a > b) + return gcd(a % b, b); + else + return gcd(a, b % a); +} + +int main(){ + int a, b; + int c; + a = getint(); + b = getint(); + c = gcd(a, b); + return c; +} diff --git a/tests/upload/heap_sort.in b/tests/upload/heap_sort.in new file mode 100644 index 0000000..10bada3 --- /dev/null +++ b/tests/upload/heap_sort.in @@ -0,0 +1,11 @@ +10 +3 +4 +6 +7 +9 +20 +-1 +-2 +-4 +0 diff --git a/tests/upload/heap_sort.out b/tests/upload/heap_sort.out new file mode 100644 index 0000000..e34e9d9 --- /dev/null +++ b/tests/upload/heap_sort.out @@ -0,0 +1,2 @@ +10: -4 -2 -1 0 3 4 6 7 9 20 +0 \ No newline at end of file diff --git a/tests/upload/heap_sort.sy b/tests/upload/heap_sort.sy new file mode 100644 index 0000000..0eeede3 --- /dev/null +++ b/tests/upload/heap_sort.sy @@ -0,0 +1,63 @@ +int a[1000]; + +void PercDown(int a[],int p,int n) +{/* 下滤:将H中以H->Data[p]为根的子堆调整为最大堆 */ + int X; + int Parent,Child;//下标从0开始,左儿子是Parent*2+1,n是取不到的位置 + + X=a[p]; /* 取出根结点存放的值 */ + + Parent=p; + while((Parent*2+1)a[Child]){ + Child = Child+1; + } + if(X>=a[Child]){ + break; + } + else{ + a[Parent]=a[Child]; + } + Parent=Child; + } + a[Parent]=X; +} + +/*堆排序*/ +void HeapSort(int a[],int n) +{ + int i; + int ttt; + + i=n/2-1; + while(i>=0){/* 建立最大堆 */ + PercDown(a,i,n); + i=i-1; + } + i=n-1; + while(i>0){ + /* 删除最大堆顶 */ + ttt = a[0]; + a[0] = a[i]; + a[i] = ttt; + PercDown(a,0,i);//把0位根节点调成最大堆,堆(删除最大元素后)的大小是i,i是取不到的位置 + i=i-1; + } +} + +int main() +{ + int size; + int i; + size = getint(); + i = 0; + while(i=1&&a[i-1]>tmp){ + a[i]=a[i-1];/*依次与已排序序列中元素比较并右移*/ + i=i-1; + } + a[i]=tmp;/*放进合适的位置 */ + p=p+1; + } +} + +int main() +{ + int size; + int i; + size = getint(); + i = 0; + while(i=0){ + x=x; + y=y; + z=z; + a=a; + b=b; + c=c; + d=d; + e=e; + f=f; + g=g; + h=h; + i=i; + j=j; + k=k; + l=l; + m=m; + n=n; + o=o; + p=p; + q=q; + r=r; + s=s; + u=u; + v=v; + w=w; + }else{ + x=x; + y=y; + z=z; + a=a; + b=b; + c=c; + d=d; + e=e; + f=f; + g=g; + h=h; + i=i; + j=j; + k=k; + l=l; + m=m; + n=n; + o=o; + p=p; + q=q; + r=r; + s=s; + u=u; + v=v; + w=w; + } + x=x; + y=y; + z=z; + a=a; + b=b; + c=c; + d=d; + e=e; + f=f; + g=g; + h=h; + i=i; + j=j; + k=k; + l=l; + m=m; + n=n; + o=o; + p=p; + q=q; + r=r; + s=s; + u=u; + v=v; + w=w; + if(para<0){ + x=x; + y=y; + z=z; + a=a; + b=b; + c=c; + d=d; + e=e; + f=f; + g=g; + h=h; + i=i; + j=j; + k=k; + l=l; + m=m; + n=n; + o=o; + p=p; + q=q; + r=r; + s=s; + u=u; + v=v; + w=w; + }else{ + x=x; + y=y; + z=z; + a=a; + b=b; + c=c; + d=d; + e=e; + f=f; + g=g; + h=h; + i=i; + j=j; + k=k; + l=l; + m=m; + n=n; + o=o; + p=p; + q=q; + r=r; + s=s; + u=u; + v=v; + w=w; + } + return a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z; +} + +int main(){ + + putint(fun(1)); + return 0; +} \ No newline at end of file diff --git a/tests/upload/many_param.out b/tests/upload/many_param.out new file mode 100644 index 0000000..951c23d --- /dev/null +++ b/tests/upload/many_param.out @@ -0,0 +1,2 @@ +28 +0 diff --git a/tests/upload/many_param.sy b/tests/upload/many_param.sy new file mode 100644 index 0000000..16f7ba5 --- /dev/null +++ b/tests/upload/many_param.sy @@ -0,0 +1,10 @@ +int f(int a, int b, int c, int d, int e, int f, int g){ + return a+b+c+d+e+f+g; +} + +int main(){ + int a ; + a = f(1,2,3,4,5,6,7); + putint(a); + return 0; +} diff --git a/tests/upload/matrix-1.in b/tests/upload/matrix-1.in new file mode 100644 index 0000000..2763f48 --- /dev/null +++ b/tests/upload/matrix-1.in @@ -0,0 +1,11 @@ +10 +0 1 -1 1 -1 -1 0 1 -1 -2 +1 -2 -1 0 1 0 0 -1 -1 -1 +0 1 0 -2 0 0 -1 -1 0 -2 +-2 1 0 -1 1 -2 1 -1 -1 0 +0 -2 1 -2 1 0 0 -2 0 -2 +-1 -2 1 -2 0 -1 -2 -2 1 -2 +1 0 -2 -2 1 1 1 0 1 -1 +-1 1 0 -1 1 1 0 -1 0 0 +1 0 1 -2 0 0 0 -1 -1 -2 +0 0 -1 1 0 -1 1 -2 -1 1 diff --git a/tests/upload/matrix-1.out b/tests/upload/matrix-1.out new file mode 100644 index 0000000..5c34874 --- /dev/null +++ b/tests/upload/matrix-1.out @@ -0,0 +1,12 @@ +-1328 +-331/664 71/664 1031/664 1/332 65/83 -303/332 -24/83 -183/166 -549/664 9/664 +-73/332 -37/332 433/332 5/83 55/83 -125/166 -47/166 -91/166 -261/332 7/332 +-39/166 -15/83 129/166 5/166 69/83 -52/83 -65/166 -87/166 -43/83 -19/166 +-33/664 -19/664 837/664 -33/332 96/83 -293/332 -38/83 -103/166 -807/664 35/664 +-197/332 123/332 741/332 26/83 120/83 -235/166 -95/166 -191/166 -577/332 -113/332 +28/83 -4/83 -99/83 -27/83 -48/83 47/83 19/83 88/83 66/83 3/83 +20/83 -65/166 -47/83 -3/166 25/83 -2/83 39/166 19/166 35/166 14/83 +6/83 11/83 -39/83 12/83 -34/83 16/83 10/83 7/83 26/83 -29/83 +-181/664 -235/664 969/664 -15/332 104/83 -269/332 -27/166 -80/83 -895/664 31/664 +-18/83 17/166 -49/83 11/166 -64/83 35/83 23/166 41/166 93/166 4/83 +0 \ No newline at end of file diff --git a/tests/upload/matrix-1.sy b/tests/upload/matrix-1.sy new file mode 100644 index 0000000..e8d4131 --- /dev/null +++ b/tests/upload/matrix-1.sy @@ -0,0 +1,309 @@ +int map1[110][110], i, j, k, l, m, n, p, vis[110][110], num; +int just[110][110]; +int just2[110][110]; + +int myabs(int a) +{ + if (a >= 0) + return a; + else + return -1 * a; +} + +void print(int map[][110], int n) //打印矩阵 +{ + int i,j; + i = 1; + while (i <= n) + { + j = 1; + while (j < n) + { + //printf("%d ", map[i][j]); + putf("%d ",map[i][j]); + j = j + 1; + } + putf("%d ",map[i][j]); + i = i + 1; + } +} + +void init_vis() +{ + int i = 0; + int j = 0; + while (i < 110) + { + j = 0; + while (j < 110) + { + vis[i][j] = 0; + j = j + 1; + } + i = i + 1; + } +} + +int slove(int map[][110], int n) //三阶行列式求值,高阶的请自动忽略 +{ + init_vis(); + int i, j, ans = 0; + if (n == 1) + return map[1][1]; + if (n == 2) + return map[1][1] * map[2][2] - map[1][2] * map[2][1]; + i = 1; + while (i <= n) + { + int help = 1; + j = 0; + while (j < n) + { + int cnt = i + j; + cnt = cnt % n; + if (cnt == 0) + cnt = n; + if (vis[1 + j][cnt] == 0) + { + help = help * map[1 + j][cnt]; + vis[1 + j][cnt] = 1; + } + else + break; + j = j + 1; + } + ans = ans + help; + i = i + 1; + } + init_vis(); + i = 1; + while (i <= n) + { + int help = 1; + j = 0; + while (j < n) + { + int cnt = i + j; + cnt = cnt % n; + if (cnt == 0) + cnt = n; + if (vis[n - j][cnt] == 0) + { + help = help * map[n - j][cnt]; + vis[n - j][cnt] = 1; + } + j = j + 1; + } + ans = ans - help; + i = i + 1; + } + return ans; +} + +void get(int numi, int numj, int map[][110], int n) //得到余子式 +{ + int help[110][110], i, j, k, l; + i = 0; + while (i < n + 10) + { + j = 0; + while (j < n + 10) + { + help[i][j] = 1; + j = j + 1; + } + i = i + 1; + } + + i = 1; + while (i <= n - 1) + { + j = 1; + while (j <= n - 1) + { + if (i >= numi && j < numj) + { + help[i][j] = map[i + 1][j]; + } + else + { + if (i >= numi && j >= numj) + { + help[i][j] = map[i + 1][j + 1]; + } + else + { + if (i < numi && j >= numj) + { + help[i][j] = map[i][j + 1]; + } + else + { + if (i < numi && j < numj) + { + help[i][j] = map[i][j]; + } + } + } + } + j = j + 1; + } + i = i + 1; + } + + i = 0; + while (i <= n - 1) + { + j = 0; + while (j <= n - 1) + { + just[i][j] = help[i][j]; + j = j + 1; + } + i = i + 1; + } +} + +int getans(int nn) //求当前行列式为just时,just的值。 +{ + int map[110][110]; + int i, j; + i = 1; + while (i <= nn) + { + j = 1; + while (j <= nn) + { + map[i][j] = just[i][j]; + j = j + 1; + } + i = i + 1; + } + if (nn == 2) + return map[1][1] * map[2][2] - map[1][2] * map[2][1]; + else + { + if (nn == 1) + return map[1][1]; + else + { + int cnb = 0; + int i = 1; + while (i <= nn) + { + get(1, i, map, nn); //得到当前余子式 just + // printf("pay attention!\n"); + if (i % 2 == 1) + cnb = cnb + map[1][i] * getans(nn - 1); + else + cnb = cnb - map[1][i] * getans(nn - 1); + i = i + 1; + } + return cnb; + } + } +} +int gcd(int m, int n) //求逆矩阵时约分 +{ + if (m < n) + gcd(n, m); + if (n == 0) + return m; + else + return gcd(n, m % n); +} +void final(int n, int m) //打印当前两个值相除得到的最简分数 +{ + if (n * m < 0) + { + putch(45); + final(myabs(n), myabs(m)); + return; + } + if (m == 1) + putf("%d ",n); + else + { + if (n % m == 0) + putf("%d ",n/m); + else + { + if (n < 0 && m < 0) + { + n = -n; + m = -m; + } + putf("%d/%d ", n / gcd(n, m), m / gcd(n, m)); + } + } +} +int main() +{ + //freopen("matrix-1.in", "r", stdin); + //printf("please input the determinant`s size:\n");//输入矩阵的规格 + //scanf("%d", &n); + n = getint(); + + i=0; + while(i= 0) + return a; + else + return -1 * a; +} + +void print(int map[][110], int n) //打印矩阵 +{ + int i,j; + i = 1; + while (i <= n) + { + j = 1; + while (j < n) + { + //printf("%d ", map[i][j]); + putf("%d ",map[i][j]); + j = j + 1; + } + putf("%d ",map[i][j]); + i = i + 1; + } +} + +void init_vis() +{ + int i = 0; + int j = 0; + while (i < 110) + { + j = 0; + while (j < 110) + { + vis[i][j] = 0; + j = j + 1; + } + i = i + 1; + } +} + +int slove(int map[][110], int n) //三阶行列式求值,高阶的请自动忽略 +{ + init_vis(); + int i, j, ans = 0; + if (n == 1) + return map[1][1]; + if (n == 2) + return map[1][1] * map[2][2] - map[1][2] * map[2][1]; + i = 1; + while (i <= n) + { + int help = 1; + j = 0; + while (j < n) + { + int cnt = i + j; + cnt = cnt % n; + if (cnt == 0) + cnt = n; + if (vis[1 + j][cnt] == 0) + { + help = help * map[1 + j][cnt]; + vis[1 + j][cnt] = 1; + } + else + break; + j = j + 1; + } + ans = ans + help; + i = i + 1; + } + init_vis(); + i = 1; + while (i <= n) + { + int help = 1; + j = 0; + while (j < n) + { + int cnt = i + j; + cnt = cnt % n; + if (cnt == 0) + cnt = n; + if (vis[n - j][cnt] == 0) + { + help = help * map[n - j][cnt]; + vis[n - j][cnt] = 1; + } + j = j + 1; + } + ans = ans - help; + i = i + 1; + } + return ans; +} + +void get(int numi, int numj, int map[][110], int n) //得到余子式 +{ + int help[110][110], i, j, k, l; + i = 0; + while (i < n + 10) + { + j = 0; + while (j < n + 10) + { + help[i][j] = 1; + j = j + 1; + } + i = i + 1; + } + + i = 1; + while (i <= n - 1) + { + j = 1; + while (j <= n - 1) + { + if (i >= numi && j < numj) + { + help[i][j] = map[i + 1][j]; + } + else + { + if (i >= numi && j >= numj) + { + help[i][j] = map[i + 1][j + 1]; + } + else + { + if (i < numi && j >= numj) + { + help[i][j] = map[i][j + 1]; + } + else + { + if (i < numi && j < numj) + { + help[i][j] = map[i][j]; + } + } + } + } + j = j + 1; + } + i = i + 1; + } + + i = 0; + while (i <= n - 1) + { + j = 0; + while (j <= n - 1) + { + just[i][j] = help[i][j]; + j = j + 1; + } + i = i + 1; + } +} + +int getans(int nn) //求当前行列式为just时,just的值。 +{ + int map[110][110]; + int i, j; + i = 1; + while (i <= nn) + { + j = 1; + while (j <= nn) + { + map[i][j] = just[i][j]; + j = j + 1; + } + i = i + 1; + } + if (nn == 2) + return map[1][1] * map[2][2] - map[1][2] * map[2][1]; + else + { + if (nn == 1) + return map[1][1]; + else + { + int cnb = 0; + int i = 1; + while (i <= nn) + { + get(1, i, map, nn); //得到当前余子式 just + // printf("pay attention!\n"); + if (i % 2 == 1) + cnb = cnb + map[1][i] * getans(nn - 1); + else + cnb = cnb - map[1][i] * getans(nn - 1); + i = i + 1; + } + return cnb; + } + } +} +int gcd(int m, int n) //求逆矩阵时约分 +{ + if (m < n) + gcd(n, m); + if (n == 0) + return m; + else + return gcd(n, m % n); +} +void final(int n, int m) //打印当前两个值相除得到的最简分数 +{ + if (n * m < 0) + { + putch(45); + final(myabs(n), myabs(m)); + return; + } + if (m == 1) + putf("%d ",n); + else + { + if (n % m == 0) + putf("%d ",n/m); + else + { + if (n < 0 && m < 0) + { + n = -n; + m = -m; + } + putf("%d/%d ", n / gcd(n, m), m / gcd(n, m)); + } + } +} +int main() +{ + //freopen("matrix-1.in", "r", stdin); + //printf("please input the determinant`s size:\n");//输入矩阵的规格 + //scanf("%d", &n); + n = getint(); + + i=0; + while(ii) + { + temp=n[i][j]; + n[i][j]=n[j][i]; + n[j][i]=temp; + } + j=j+1; + } + i=i+1; + } + + i=0; + while( i<3) + { + j=0; + while(j<3){ + putint(n[i][j]); + putch(32); + j=j+1; + } + putch(10); + i=i+1; + } + return 0; +} \ No newline at end of file diff --git a/tests/upload/matrix_vector.in b/tests/upload/matrix_vector.in new file mode 100755 index 0000000..073bae5 --- /dev/null +++ b/tests/upload/matrix_vector.in @@ -0,0 +1,4 @@ +3 1 2 3 +4 1 2 3 4 +4 1 2 3 4 +4 1 2 3 4 \ No newline at end of file diff --git a/tests/upload/matrix_vector.out b/tests/upload/matrix_vector.out new file mode 100755 index 0000000..121a58f --- /dev/null +++ b/tests/upload/matrix_vector.out @@ -0,0 +1,2 @@ +4: 6 12 18 24 +0 diff --git a/tests/upload/matrix_vector.sy b/tests/upload/matrix_vector.sy new file mode 100755 index 0000000..6c98850 --- /dev/null +++ b/tests/upload/matrix_vector.sy @@ -0,0 +1,34 @@ +int vector[100]; +int matrix[100][100]; +int result[100]; + +void calculate(int n,int m){ + int i = 0; + int j = 0; + int temp = 0; + while(i= end) + return; + int mid = (start + end) / 2; + mergeSort(start, mid); + mergeSort(mid + 1, end); + merge(start, mid, end); +} + +void printArray(int n) +{ + int i = 0; + while (i < n) + { + putint(arr[i]); + putch(32); + // printf("%d ", arr[i]); + i = i + 1; + } +} + +int main() +{ + int n; + int i = 0; + n = getint(); + while (i < n) + { + arr[i] = getint(); + i = i + 1; + } + mergeSort(0,n-1); + printArray(n); + return 0; +} \ No newline at end of file diff --git a/tests/upload/merge_sort_xunhuan.in b/tests/upload/merge_sort_xunhuan.in new file mode 100644 index 0000000..10bada3 --- /dev/null +++ b/tests/upload/merge_sort_xunhuan.in @@ -0,0 +1,11 @@ +10 +3 +4 +6 +7 +9 +20 +-1 +-2 +-4 +0 diff --git a/tests/upload/merge_sort_xunhuan.out b/tests/upload/merge_sort_xunhuan.out new file mode 100644 index 0000000..e34e9d9 --- /dev/null +++ b/tests/upload/merge_sort_xunhuan.out @@ -0,0 +1,2 @@ +10: -4 -2 -1 0 3 4 6 7 9 20 +0 \ No newline at end of file diff --git a/tests/upload/merge_sort_xunhuan.sy b/tests/upload/merge_sort_xunhuan.sy new file mode 100644 index 0000000..55529ec --- /dev/null +++ b/tests/upload/merge_sort_xunhuan.sy @@ -0,0 +1,88 @@ +int a[1000]; + +/* L = 左边起始位置, R = 右边起始位置, RightEnd = 右边终点位置*/ +void Merge(int a[],int tmpA[],int L,int R,int RightEnd) +{ + /* 将有序的A[L]~A[R-1]和A[R]~A[RightEnd]归并成一个有序序列 */ + int LeftEnd; + int tmp; + + LeftEnd=R-1;/* 左边终点位置 */ + tmp=L;/* 有序序列的起始位置 */ + + while(L<=LeftEnd&&R<=RightEnd){ + if(a[L] arr[l]) + { + i = i + 1; + } + else + { + tmp = arr[j + 1]; + arr[j + 1] = arr[i]; + arr[i] = tmp; + i = i + 1; + j = j + 1; + } + } + tmp = arr[j]; + arr[j] = arr[l]; + arr[l] = tmp; + return j; +} + +void _quickSort(int l, int r) +{ + int key; + if (l >= r) + { + return; + } + key = partition( l, r); + _quickSort( l, key - 1); + _quickSort( key + 1, r); +} + +void quickSort(int n) +{ + _quickSort(0, n - 1); + return; +} + +void printArray(int n) +{ + int i = 0; + while (i < n) + { + putint(arr[i]); + putch(32); + // printf("%d ", arr[i]); + i = i + 1; + } +} + +int main() +{ + int n; + int i = 0; + n = getint(); + while (i < n) + { + arr[i] = getint(); + i = i + 1; + } + quickSort(n); + printArray(n); + return 0; +} \ No newline at end of file diff --git a/tests/upload/select_sort.in b/tests/upload/select_sort.in new file mode 100755 index 0000000..549004f --- /dev/null +++ b/tests/upload/select_sort.in @@ -0,0 +1 @@ +4 1 221 521 25 \ No newline at end of file diff --git a/tests/upload/select_sort.out b/tests/upload/select_sort.out new file mode 100755 index 0000000..5a25c42 --- /dev/null +++ b/tests/upload/select_sort.out @@ -0,0 +1,2 @@ +1 25 221 521 +0 \ No newline at end of file diff --git a/tests/upload/select_sort.sy b/tests/upload/select_sort.sy new file mode 100755 index 0000000..33a6f0a --- /dev/null +++ b/tests/upload/select_sort.sy @@ -0,0 +1,56 @@ +int arr[100]; + +void selectSort(int n) +{ + int i = 0; + int j = 0; + int minValue; + int tmp; + while (i < n - 1) + { + minValue = i; + j = i + 1; + while (j < n) + { + if (arr[minValue] > arr[j]) + { + minValue = j; + } + j = j + 1; + } + if (minValue != i) + { + tmp = arr[i]; + arr[i] = arr[minValue]; + arr[minValue] = tmp; + } + i = i + 1; + } +} + +void printArray(int n) +{ + int i = 0; + while (i < n) + { + putint(arr[i]); + putch(32); + // printf("%d ", arr[i]); + i = i + 1; + } +} + +int main() +{ + int n; + int i = 0; + n = getint(); + while (i < n) + { + arr[i] = getint(); + i = i + 1; + } + selectSort(n); + printArray(n); + return 0; +} \ No newline at end of file diff --git a/tests/upload/shell_sort.in b/tests/upload/shell_sort.in new file mode 100644 index 0000000..10bada3 --- /dev/null +++ b/tests/upload/shell_sort.in @@ -0,0 +1,11 @@ +10 +3 +4 +6 +7 +9 +20 +-1 +-2 +-4 +0 diff --git a/tests/upload/shell_sort.out b/tests/upload/shell_sort.out new file mode 100644 index 0000000..e34e9d9 --- /dev/null +++ b/tests/upload/shell_sort.out @@ -0,0 +1,2 @@ +10: -4 -2 -1 0 3 4 6 7 9 20 +0 \ No newline at end of file diff --git a/tests/upload/shell_sort.sy b/tests/upload/shell_sort.sy new file mode 100644 index 0000000..707cfd3 --- /dev/null +++ b/tests/upload/shell_sort.sy @@ -0,0 +1,61 @@ +int a[1000]; + +/* 希尔排序 - 用Sedgewick增量序列 */ +void ShellSort(int a[],int n) +{ + /* 这里只列出一小部分增量 */ + int Sedgewick[10]; + int si; + int D; + int i; + int p; + int tmp; + + Sedgewick[0] = 929; + Sedgewick[1] = 505; + Sedgewick[2] = 209; + Sedgewick[3] = 109; + Sedgewick[4] = 41; + Sedgewick[5] = 19; + Sedgewick[6] = 5; + Sedgewick[7] = 1; + Sedgewick[8] = 0; + + si=0; + while(Sedgewick[si]>=n) { + si = si+1; + } + + D=Sedgewick[si]; + while(D>0){ + p=D; + while(p=D&&a[i-D]>tmp){ + a[i]=a[i-D]; + i=i-D; + } + a[i]=tmp; + p=p+1; + } + si=si+1; + D=Sedgewick[si]; + } +} + +int main() +{ + int size; + int i; + size = getint(); + i = 0; + while(ilenb) { + lenc = lena; + } + else{ + lenc = lenb; + } + i=0; + while (i<=lenc) { + c[i] = 0; + i=i+1; + } + i=0; + while (i= 10) { + c[i+1] = c[i+1] + 1; + c[i] = c[i] - 10; + } + i=i+1; + } + if (c[lenc]) { //有进位 数组c的长度+1 + lenc = lenc+1; + } + //b<-c + i=0; + while (i= 10) { + c[i+1] = c[i+1] + (c[i] / 10); + c[i] = c[i] % 10; + } + i=i+1; + } + //最高位的值可能>=10 要展开成多位 + while (c[lenc] >= 10) { + c[lenc+1] = c[lenc+1] + (c[lenc] / 10); + c[lenc] = c[lenc] % 10; + lenc = lenc+1; + } + if (c[lenc]) { //0<最高位<=10 也要长度+1 + lenc = lenc+1; + } + //a<-c + i=0; + while (i=0) { + putint(b[i]); + i=i-1; + } + putch(10); + return 0; +} \ No newline at end of file diff --git a/tests/upload/test1_2.in b/tests/upload/test1_2.in new file mode 100644 index 0000000..1627a54 --- /dev/null +++ b/tests/upload/test1_2.in @@ -0,0 +1 @@ +99 diff --git a/tests/upload/test1_2.out b/tests/upload/test1_2.out new file mode 100644 index 0000000..2e58685 --- /dev/null +++ b/tests/upload/test1_2.out @@ -0,0 +1,2 @@ +942786239765826579160595268206839381354754349601050974345395410407078230249590414458830117442618180732911203520208889371641659121356556442336528920420940313 +0 \ No newline at end of file diff --git a/tests/upload/test1_2.sy b/tests/upload/test1_2.sy new file mode 100644 index 0000000..3dc1d51 --- /dev/null +++ b/tests/upload/test1_2.sy @@ -0,0 +1,105 @@ +int a[1000]; +int b[1000]; +int c[1000]; +int lena; +int lenb; +int lenc; + + +void add() { //b=b+a + int i; + + if (lena>lenb) { + lenc = lena; + } + else{ + lenc = lenb; + } + i=0; + while (i<=lenc) { + c[i] = 0; + i=i+1; + } + i=0; + while (i= 10) { + c[i+1] = c[i+1] + 1; + c[i] = c[i] - 10; + } + i=i+1; + } + if (c[lenc]) { //有进位 数组c的长度+1 + lenc = lenc+1; + } + //b<-c + i=0; + while (i= 10) { + c[i+1] = c[i+1] + (c[i] / 10); + c[i] = c[i] % 10; + } + i=i+1; + } + //最高位的值可能>=10 要展开成多位 + while (c[lenc] >= 10) { + c[lenc+1] = c[lenc+1] + (c[lenc] / 10); + c[lenc] = c[lenc] % 10; + lenc = lenc+1; + } + if (c[lenc]) { //0<最高位<=10 也要长度+1 + lenc = lenc+1; + } + //a<-c + i=0; + while (i=0) { + putint(b[i]); + i=i-1; + } + putch(10); + return 0; +} \ No newline at end of file diff --git a/tests/upload/test2_1.in b/tests/upload/test2_1.in new file mode 100644 index 0000000..396d1fb --- /dev/null +++ b/tests/upload/test2_1.in @@ -0,0 +1,51 @@ +50 50 +0 25 26 52 77 88 64 98 21 56 86 81 53 53 22 49 70 96 25 34 81 92 42 16 46 40 9 61 53 73 66 34 66 97 27 77 51 86 26 79 81 90 79 99 53 82 79 80 28 41 +45 61 96 33 94 80 22 3 66 19 53 31 83 15 71 66 92 96 71 0 2 71 97 4 51 47 5 54 92 16 73 86 26 20 59 48 85 28 69 96 82 56 51 97 86 74 35 34 70 51 +18 57 4 51 45 8 34 44 54 20 0 13 77 3 10 97 86 41 15 0 90 63 42 12 97 20 74 74 84 88 43 49 3 44 40 83 81 0 67 0 88 4 75 18 60 41 62 99 29 95 +80 98 67 84 95 65 31 70 11 11 25 31 76 12 77 14 82 48 57 37 18 82 41 62 12 69 21 98 43 39 73 76 13 76 50 5 58 49 51 83 31 15 67 58 95 86 86 9 97 75 +65 52 84 11 65 32 20 82 54 0 35 10 16 7 70 50 84 85 41 94 7 11 66 56 16 1 93 63 97 26 62 3 27 44 7 57 30 33 63 99 78 78 28 33 59 6 17 85 97 45 +88 30 67 0 19 79 94 96 67 14 70 63 78 74 38 53 20 13 39 51 90 38 60 27 35 5 87 85 2 0 36 94 71 25 67 51 0 59 0 37 64 67 99 75 42 29 20 39 93 77 +2 53 78 52 5 9 11 77 70 73 16 16 41 96 21 20 54 0 52 1 39 27 89 43 72 53 84 97 26 44 22 79 39 69 78 68 5 82 21 79 16 32 27 42 71 76 86 28 48 64 +81 82 12 42 97 97 14 49 50 45 28 86 26 30 69 42 81 17 66 17 60 65 84 24 13 75 92 30 11 61 97 11 27 77 9 75 95 66 56 9 10 18 49 41 9 95 13 52 38 87 +74 46 67 41 66 54 15 66 3 2 8 17 96 42 60 56 15 44 29 9 35 60 59 32 8 53 40 79 62 24 90 19 38 13 70 41 80 17 73 89 13 29 96 84 14 85 75 55 65 3 +27 59 59 45 69 99 29 1 24 44 82 96 84 71 4 70 79 72 36 67 4 15 15 37 18 88 67 26 7 16 8 34 97 77 18 77 50 24 77 44 77 96 36 58 84 25 49 86 38 7 +33 57 33 19 62 3 94 26 58 96 85 35 30 65 88 70 58 60 70 5 54 93 17 97 50 77 6 66 88 28 53 92 70 44 37 27 46 86 48 49 40 82 93 98 18 62 68 23 83 29 +35 88 79 51 31 42 45 1 81 31 42 53 92 50 49 87 39 79 38 59 67 49 94 41 24 34 19 96 98 96 96 29 55 55 33 82 72 64 61 28 39 10 98 69 5 92 71 75 9 61 +21 50 10 50 65 53 40 14 96 1 38 67 3 87 56 2 99 41 7 43 66 5 98 8 82 7 94 86 68 76 95 17 89 28 82 37 35 85 4 29 43 32 21 95 99 5 85 74 5 10 +11 59 22 6 18 7 85 43 54 68 72 73 35 38 72 51 76 88 78 42 83 22 43 96 93 73 4 10 48 13 91 41 79 59 41 3 65 21 76 59 44 46 21 7 71 87 11 85 85 92 +7 57 22 87 10 71 44 83 58 54 98 46 92 74 18 86 21 1 77 19 48 63 64 4 85 44 83 2 7 71 49 20 50 40 61 25 51 5 93 66 8 42 26 34 68 24 49 18 81 17 +94 16 24 84 48 39 60 69 45 27 82 88 93 66 6 25 57 19 42 19 88 85 39 50 50 18 19 81 42 96 5 80 87 2 1 22 75 82 29 58 64 66 47 82 20 47 28 80 44 18 +58 27 84 95 0 51 43 29 65 93 59 38 74 97 58 97 63 18 55 25 86 76 12 37 76 61 62 57 95 80 17 26 41 30 67 51 1 69 40 36 34 37 70 24 85 48 27 40 31 6 +61 56 87 78 49 58 19 41 77 16 47 22 72 0 51 39 19 40 85 26 29 26 55 60 62 75 15 71 62 49 90 25 12 96 84 97 91 88 42 1 1 42 76 47 90 52 47 17 76 28 +93 92 4 51 38 96 45 36 89 53 26 98 5 64 23 26 16 44 30 7 95 20 34 39 5 74 0 2 95 39 8 69 26 93 19 81 48 59 37 31 84 73 40 64 78 82 87 27 16 56 +35 8 49 77 2 70 62 16 50 43 51 73 97 91 47 58 52 13 67 7 73 11 8 5 93 66 99 49 21 36 76 0 19 38 23 0 39 49 12 87 36 37 22 37 71 69 50 15 15 28 +71 62 16 9 18 10 73 11 14 58 17 99 44 17 65 42 86 66 49 37 83 10 58 98 72 65 90 98 74 40 80 62 4 8 16 56 85 11 49 13 48 98 83 18 89 4 89 34 77 75 +40 45 25 92 6 20 53 77 81 75 83 91 67 8 21 28 81 91 70 50 83 31 85 30 61 82 27 87 89 86 69 85 49 74 54 81 78 23 78 17 89 10 17 28 63 88 88 80 70 36 +8 72 32 97 10 43 34 81 29 20 54 57 61 31 3 8 94 0 43 80 21 34 89 81 77 90 73 92 22 13 55 71 35 92 3 36 18 35 7 18 75 50 82 65 93 29 65 2 95 72 +1 65 72 3 96 47 92 63 96 61 37 7 80 15 0 52 20 29 53 81 13 64 56 95 89 32 40 44 66 18 73 8 36 72 84 60 34 76 11 20 99 40 0 51 8 65 20 18 36 0 +37 72 11 16 52 92 44 19 40 45 34 67 71 82 79 29 51 63 38 85 52 69 89 68 31 96 13 57 52 2 65 0 30 43 94 64 84 16 26 11 96 84 6 23 89 50 7 94 12 41 +94 14 39 78 81 54 63 26 25 16 56 53 92 34 51 19 54 76 18 27 83 2 34 73 52 22 44 48 23 12 5 23 67 20 3 7 45 78 10 54 72 48 6 75 57 55 24 92 78 32 +60 93 54 1 93 38 55 49 22 72 92 50 24 4 36 7 7 25 20 89 59 52 17 25 11 82 13 82 78 81 50 42 15 56 16 35 45 77 5 81 60 30 84 19 13 70 78 56 12 38 +14 74 74 68 36 28 13 15 29 95 54 53 45 13 21 67 52 63 68 5 21 21 49 49 50 29 47 0 12 95 80 98 7 47 87 59 41 51 34 61 95 26 34 90 62 31 71 14 57 74 +39 91 77 46 31 27 82 58 40 34 40 28 82 78 36 34 40 81 86 7 88 49 54 54 90 76 43 59 20 62 24 31 66 29 50 46 12 24 72 24 28 21 39 78 16 71 22 36 36 5 +58 71 79 48 28 53 0 35 59 22 17 18 18 46 59 97 64 93 80 88 32 29 46 76 33 29 21 64 25 19 38 62 86 82 68 91 9 20 45 2 97 80 31 12 5 21 46 32 0 23 +52 99 93 5 83 90 62 66 6 35 45 70 11 52 53 12 14 36 12 76 52 32 58 66 20 18 11 42 88 2 38 72 14 34 78 11 99 51 73 31 16 77 96 52 33 25 41 97 58 58 +82 23 50 91 37 77 92 74 47 23 58 53 84 77 65 23 99 80 17 46 6 81 19 11 38 50 32 83 11 49 41 82 85 80 18 83 80 52 74 74 14 3 59 2 7 64 65 92 71 32 +10 25 8 13 35 49 34 83 22 26 20 82 52 91 24 44 32 8 86 6 34 15 38 25 3 95 50 87 61 87 67 61 39 26 80 49 9 99 60 41 25 35 12 87 76 23 64 83 25 24 +62 98 37 89 47 93 18 95 74 31 14 33 87 72 40 35 4 13 66 0 95 70 25 43 24 38 7 64 60 31 48 57 44 73 75 51 44 74 77 68 17 60 36 77 15 68 19 52 67 15 +46 27 61 94 5 93 12 68 6 77 53 20 41 80 75 38 18 89 40 88 27 8 27 37 53 59 92 28 35 22 81 23 27 38 85 4 70 63 80 70 98 62 85 57 74 30 64 11 29 50 +46 90 7 17 2 21 43 47 84 39 80 99 61 76 88 45 36 60 59 29 86 77 46 45 22 35 43 76 18 0 12 90 18 70 76 20 32 22 83 39 80 8 87 80 94 47 6 94 0 16 +76 13 42 74 93 11 36 24 3 73 89 28 82 48 42 31 38 51 86 82 20 88 76 27 20 59 77 90 85 68 95 80 57 34 41 22 39 84 14 39 27 28 1 7 33 96 0 66 11 82 +24 31 34 14 7 55 65 76 38 79 30 71 20 13 76 51 58 43 31 93 1 1 90 61 86 90 70 48 38 87 53 20 9 38 49 90 80 14 39 91 59 20 29 82 96 92 81 73 87 77 +42 23 39 25 1 6 97 44 7 44 7 65 31 10 49 18 16 49 90 3 81 9 62 78 26 25 64 99 46 64 98 64 55 66 7 73 24 46 86 49 30 23 11 31 47 8 63 56 45 34 +90 30 88 31 36 57 45 48 66 77 8 59 14 87 12 7 83 38 35 83 17 92 91 61 97 77 94 68 44 3 40 25 88 4 91 38 80 48 15 10 64 0 12 44 0 98 19 36 19 74 +47 94 8 96 43 98 70 79 25 30 82 38 26 92 63 47 59 82 66 82 89 4 7 18 48 65 64 8 89 91 36 70 33 56 35 88 7 7 67 76 93 2 75 94 89 44 28 27 78 51 +96 13 96 23 62 62 21 3 19 87 65 29 61 43 73 2 10 88 29 52 27 63 80 67 33 37 78 67 71 11 17 63 6 9 86 35 19 75 45 92 45 44 15 50 32 5 14 50 2 17 +31 99 14 10 31 17 82 58 41 58 14 90 55 81 3 50 44 54 83 10 54 33 33 95 2 17 97 47 15 52 75 75 64 29 71 76 36 29 47 68 4 51 84 82 55 87 51 9 15 81 +37 40 97 57 13 97 90 78 47 61 96 69 94 9 55 33 78 41 81 11 18 95 33 7 22 3 85 13 50 10 87 43 7 8 99 44 2 12 16 63 79 85 35 76 32 64 4 40 3 35 +60 4 76 98 64 76 75 25 45 53 80 42 9 46 82 11 81 24 28 0 26 42 68 49 9 43 32 24 15 59 65 48 24 10 62 68 21 20 57 80 93 14 34 95 15 16 45 24 5 64 +99 3 68 75 60 50 26 21 57 79 53 98 0 95 60 57 55 97 82 46 87 34 29 1 41 12 97 39 75 72 21 22 96 83 55 71 73 93 85 99 73 4 4 15 67 38 4 34 13 46 +22 44 0 85 15 52 16 99 51 79 84 3 74 49 43 70 51 7 58 2 40 36 94 69 12 45 91 93 59 54 15 29 2 73 13 65 84 16 10 90 71 93 59 85 37 99 0 28 87 40 +21 40 82 52 92 39 32 67 6 82 91 53 93 57 45 86 44 13 80 98 34 55 30 32 24 94 83 69 52 98 34 58 50 79 56 73 88 96 95 21 66 16 21 57 15 78 98 94 60 4 +70 25 72 4 11 96 12 0 48 95 9 78 99 1 26 83 50 50 18 27 49 9 39 92 33 32 75 52 58 41 63 94 60 18 10 47 76 33 95 86 69 2 84 9 42 89 2 13 90 26 +33 15 54 52 73 88 49 75 4 26 86 81 70 39 13 39 82 14 23 39 39 61 28 93 77 4 14 34 70 26 2 45 15 0 93 53 2 15 38 31 19 62 3 26 62 9 1 13 46 0 diff --git a/tests/upload/test2_1.out b/tests/upload/test2_1.out new file mode 100644 index 0000000..20d0a1d --- /dev/null +++ b/tests/upload/test2_1.out @@ -0,0 +1,2 @@ +13665 +0 \ No newline at end of file diff --git a/tests/upload/test2_1.sy b/tests/upload/test2_1.sy new file mode 100644 index 0000000..9d01ba2 --- /dev/null +++ b/tests/upload/test2_1.sy @@ -0,0 +1,59 @@ +int dp[55][55][55][55]; +int a[55][55]; + +int mmax(int a, int b) { + if (a>b) { + return a; + } + else { + return b; + } +} + +int main() +{ + int m; + int n; + int i; + int j; + int k; + int l; + + m=getint(); + n=getint(); + + i=1; + while (i<=m) { + j=1; + while (j<=n) { + a[i][j]=getint(); + j=j+1; + } + i=i+1; + } + + i=1; + while(i<=m){ + j=1; + while(j<=n){ + k=1; + while(k<=m){ + l=1; + while(l<=n){ + dp[i][j][k][l]= + mmax(mmax(dp[i-1][j][k-1][l],dp[i-1][j][k][l-1]), + mmax(dp[i][j-1][k][l-1],dp[i][j-1][k-1][l]))+a[i][j]+a[k][l]; + if (i==k && j==l) { + dp[i][j][k][l] = dp[i][j][k][l] - a[k][l]; + } + l=l+1; + } + k=k+1; + } + j=j+1; + } + i=i+1; + } + putint(dp[m][n][m][n]); + return 0; +} \ No newline at end of file diff --git a/tests/upload/test2_2.in b/tests/upload/test2_2.in new file mode 100644 index 0000000..278437f --- /dev/null +++ b/tests/upload/test2_2.in @@ -0,0 +1,31 @@ +30 30 +0 47 45 44 11 26 80 37 99 57 70 68 6 79 41 32 0 36 27 10 30 93 63 89 92 51 11 73 37 52 +71 79 43 60 63 61 99 14 83 20 21 96 38 23 88 29 94 46 47 73 21 75 14 35 10 97 36 97 67 83 +0 86 64 18 15 50 18 67 87 87 70 60 68 57 2 75 81 1 25 83 78 15 10 40 3 1 38 14 1 98 +75 33 89 83 77 15 96 99 23 84 35 96 82 98 32 7 68 19 87 25 4 35 11 40 11 78 27 75 34 53 +89 52 11 28 23 46 34 69 6 43 87 84 73 43 84 16 11 42 91 88 84 86 35 90 96 91 23 37 90 14 +44 90 20 69 90 17 48 66 77 15 33 23 9 85 64 73 11 58 52 38 68 63 70 42 73 36 90 64 71 28 +62 29 94 20 14 93 82 51 43 72 37 15 20 86 43 80 6 91 28 98 40 64 74 57 17 92 64 54 85 28 +97 88 15 92 55 27 86 53 40 22 90 3 6 0 83 17 87 17 92 31 37 14 22 33 7 13 67 16 17 39 +38 55 34 15 2 46 42 45 61 18 72 63 99 2 9 49 76 94 17 19 48 32 52 83 19 30 50 88 45 19 +49 94 76 38 62 60 93 85 30 14 43 93 69 24 12 56 25 40 50 90 45 67 33 4 65 93 47 28 43 26 +89 50 46 18 88 57 93 85 67 43 17 16 52 65 1 32 2 77 36 39 40 58 53 7 95 78 62 46 6 40 +55 60 20 34 7 50 77 42 22 63 37 80 4 82 49 15 11 30 9 97 75 50 58 21 97 28 38 59 76 68 +66 61 33 49 13 61 98 17 26 11 74 28 79 51 84 87 1 96 92 10 18 25 82 49 35 91 43 60 65 44 +6 50 38 33 81 30 94 25 48 34 55 90 9 69 5 88 33 58 70 5 92 68 60 70 20 22 8 26 60 53 +82 35 70 17 45 69 38 66 46 84 19 72 63 35 39 22 71 46 6 5 48 33 14 4 75 90 45 86 49 73 +43 91 40 75 96 29 14 76 50 68 24 40 51 25 71 21 48 25 10 11 40 87 50 19 41 33 13 7 10 50 +85 77 21 30 4 61 50 66 76 60 44 11 42 51 82 16 63 19 77 7 55 63 37 81 52 69 46 68 38 48 +28 96 96 54 71 89 4 39 68 38 31 98 99 91 55 11 10 58 82 86 34 58 16 93 14 27 12 79 51 47 +38 74 18 14 41 20 13 41 38 84 58 90 24 76 20 75 13 64 18 49 75 86 56 26 93 10 2 1 82 3 +42 10 77 90 98 47 21 4 96 7 83 55 69 14 0 98 35 10 39 15 22 86 24 89 32 82 50 3 42 8 +93 77 5 19 91 24 93 11 18 39 20 65 53 88 6 61 55 62 94 15 51 26 67 91 97 63 72 39 10 80 +93 93 44 17 11 76 94 2 65 56 30 40 82 28 51 76 97 60 75 44 45 37 93 74 12 1 35 3 75 34 +73 64 28 36 88 82 89 65 39 87 99 90 57 37 63 5 32 47 85 64 55 5 78 99 72 33 47 11 15 10 +72 26 40 88 99 48 16 12 70 11 57 67 20 21 92 50 28 10 41 91 57 49 84 79 19 56 88 45 94 0 +20 85 34 28 0 8 23 93 19 31 94 13 60 65 15 48 59 47 19 18 66 83 29 58 24 67 77 51 74 15 +38 88 52 44 79 7 40 8 61 14 6 45 57 65 48 79 68 31 7 58 73 1 95 31 48 94 9 97 0 34 +48 28 97 41 22 43 58 3 36 60 29 31 62 23 34 45 64 88 0 92 38 29 64 70 66 65 19 19 17 45 +11 48 16 87 80 77 37 55 52 48 99 26 35 99 47 70 24 42 74 22 77 23 72 26 2 85 26 41 76 89 +5 95 97 32 9 8 6 28 68 10 15 20 10 43 52 5 14 53 27 88 42 49 20 70 97 36 17 11 72 46 +83 40 88 65 74 21 49 90 94 94 38 97 8 91 6 66 20 46 32 7 20 24 99 87 93 3 59 70 78 0 diff --git a/tests/upload/test2_2.out b/tests/upload/test2_2.out new file mode 100644 index 0000000..079b801 --- /dev/null +++ b/tests/upload/test2_2.out @@ -0,0 +1,2 @@ +7869 +0 \ No newline at end of file diff --git a/tests/upload/test2_2.sy b/tests/upload/test2_2.sy new file mode 100644 index 0000000..9d01ba2 --- /dev/null +++ b/tests/upload/test2_2.sy @@ -0,0 +1,59 @@ +int dp[55][55][55][55]; +int a[55][55]; + +int mmax(int a, int b) { + if (a>b) { + return a; + } + else { + return b; + } +} + +int main() +{ + int m; + int n; + int i; + int j; + int k; + int l; + + m=getint(); + n=getint(); + + i=1; + while (i<=m) { + j=1; + while (j<=n) { + a[i][j]=getint(); + j=j+1; + } + i=i+1; + } + + i=1; + while(i<=m){ + j=1; + while(j<=n){ + k=1; + while(k<=m){ + l=1; + while(l<=n){ + dp[i][j][k][l]= + mmax(mmax(dp[i-1][j][k-1][l],dp[i-1][j][k][l-1]), + mmax(dp[i][j-1][k][l-1],dp[i][j-1][k-1][l]))+a[i][j]+a[k][l]; + if (i==k && j==l) { + dp[i][j][k][l] = dp[i][j][k][l] - a[k][l]; + } + l=l+1; + } + k=k+1; + } + j=j+1; + } + i=i+1; + } + putint(dp[m][n][m][n]); + return 0; +} \ No newline at end of file diff --git a/tests/upload/test3_1.in b/tests/upload/test3_1.in new file mode 100644 index 0000000..71d89f5 --- /dev/null +++ b/tests/upload/test3_1.in @@ -0,0 +1,2 @@ +30 +54 8 31 93 60 70 78 84 66 24 7 37 68 39 46 20 77 2 11 23 40 99 22 13 31 60 30 91 44 36 diff --git a/tests/upload/test3_1.out b/tests/upload/test3_1.out new file mode 100644 index 0000000..64a0e76 --- /dev/null +++ b/tests/upload/test3_1.out @@ -0,0 +1,3 @@ +2141955210 +1 2 3 4 5 30 29 9 7 6 8 10 11 12 13 28 27 26 22 18 16 14 15 17 20 19 21 24 23 25 +0 \ No newline at end of file diff --git a/tests/upload/test3_1.sy b/tests/upload/test3_1.sy new file mode 100644 index 0000000..9b11a59 --- /dev/null +++ b/tests/upload/test3_1.sy @@ -0,0 +1,64 @@ +int a[35]; +int n; +int dp[35][35]; +int root[35][35]; + +void output(int left, int right) { + int r; + + if (left>right) { + return; + } + r = root[left][right]; + putint(r); + putch(32); + output(left, r-1); //递归左子树 + output(r+1, right); //递归右子树 +} + +int main() { + int i; + int j; + int k; + int len; + + n = getint(); + + i=1; + while (i<=n) { + a[i] = getint(); + dp[i][i] = a[i]; //分数 + root[i][i] = i; //根节点 + i=i+1; + } + + len=2; + while (len<=n) { //遍历区间长度 + i=1; + while (i+len-1<=n) { //遍历起点 + j = i+len-1; //终点 + if (dp[i+1][j] + dp[i][i] > dp[i][j]) { + dp[i][j] = dp[i+1][j] + dp[i][i]; + root[i][j] = i; + } + if (dp[i][j-1] + dp[j][j] > dp[i][j]) { + dp[i][j] = dp[i][j-1] + dp[j][j]; + root[i][j] = j; + } + k=i+1; + while (k dp[i][j]) { + dp[i][j] = dp[i][k-1] * dp[k+1][j] + dp[k][k]; + root[i][j] = k; //记录根 + } + k=k+1; + } + i=i+1; + } + len=len+1; + } + putint(dp[1][n]); + putch(10); + output(1,n); //输出前序遍历 + return 0; +} \ No newline at end of file diff --git a/tests/upload/test3_2.in b/tests/upload/test3_2.in new file mode 100644 index 0000000..4a8c4a4 --- /dev/null +++ b/tests/upload/test3_2.in @@ -0,0 +1,2 @@ +30 +37 48 34 94 93 31 29 12 66 18 27 62 59 53 9 17 75 81 0 98 33 61 83 95 2 0 42 34 88 94 diff --git a/tests/upload/test3_2.out b/tests/upload/test3_2.out new file mode 100644 index 0000000..77872e7 --- /dev/null +++ b/tests/upload/test3_2.out @@ -0,0 +1,3 @@ +2145755974 +1 2 3 30 29 28 27 26 20 4 19 18 17 7 5 6 11 9 8 10 15 13 12 14 16 23 21 22 24 25 +0 \ No newline at end of file diff --git a/tests/upload/test3_2.sy b/tests/upload/test3_2.sy new file mode 100644 index 0000000..9b11a59 --- /dev/null +++ b/tests/upload/test3_2.sy @@ -0,0 +1,64 @@ +int a[35]; +int n; +int dp[35][35]; +int root[35][35]; + +void output(int left, int right) { + int r; + + if (left>right) { + return; + } + r = root[left][right]; + putint(r); + putch(32); + output(left, r-1); //递归左子树 + output(r+1, right); //递归右子树 +} + +int main() { + int i; + int j; + int k; + int len; + + n = getint(); + + i=1; + while (i<=n) { + a[i] = getint(); + dp[i][i] = a[i]; //分数 + root[i][i] = i; //根节点 + i=i+1; + } + + len=2; + while (len<=n) { //遍历区间长度 + i=1; + while (i+len-1<=n) { //遍历起点 + j = i+len-1; //终点 + if (dp[i+1][j] + dp[i][i] > dp[i][j]) { + dp[i][j] = dp[i+1][j] + dp[i][i]; + root[i][j] = i; + } + if (dp[i][j-1] + dp[j][j] > dp[i][j]) { + dp[i][j] = dp[i][j-1] + dp[j][j]; + root[i][j] = j; + } + k=i+1; + while (k dp[i][j]) { + dp[i][j] = dp[i][k-1] * dp[k+1][j] + dp[k][k]; + root[i][j] = k; //记录根 + } + k=k+1; + } + i=i+1; + } + len=len+1; + } + putint(dp[1][n]); + putch(10); + output(1,n); //输出前序遍历 + return 0; +} \ No newline at end of file diff --git a/tests/upload/test4_1.in b/tests/upload/test4_1.in new file mode 100644 index 0000000..71d89f5 --- /dev/null +++ b/tests/upload/test4_1.in @@ -0,0 +1,2 @@ +30 +54 8 31 93 60 70 78 84 66 24 7 37 68 39 46 20 77 2 11 23 40 99 22 13 31 60 30 91 44 36 diff --git a/tests/upload/test4_1.out b/tests/upload/test4_1.out new file mode 100644 index 0000000..54599e3 --- /dev/null +++ b/tests/upload/test4_1.out @@ -0,0 +1,2 @@ +21419552101 2 3 4 5 30 29 9 7 6 8 10 11 12 13 28 27 26 22 18 16 14 15 17 20 19 21 24 23 25 +0 \ No newline at end of file diff --git a/tests/upload/test4_1.sy b/tests/upload/test4_1.sy new file mode 100644 index 0000000..f82decd --- /dev/null +++ b/tests/upload/test4_1.sy @@ -0,0 +1,69 @@ +int a[35]; +int n; +int dp[35][35]; +int root[35][35]; + +void output(int left, int right) { + int r; + + if (left>right) { + return; + } + r = root[left][right]; + putint(r); + putch(32); + output(left, r-1); //递归左子树 + output(r+1, right); //递归右子树 +} + +int solve(int l, int r) { //记忆化递归 + int max1; + int max2; + int k; + int tmp; + + if (dp[l][r]) { + return dp[l][r]; + } + if (l == r) { + dp[l][r] = a[l]; + root[l][r] = l; + } + max1 = solve(l+1,r) + solve(l,l); //l为根 + if (max1 > dp[l][r]) { + dp[l][r] = max1; + root[l][r] = l; + } + max2 = solve(l,r-1) + solve(r,r); //r为根 + if (max2 > dp[l][r]) { + dp[l][r] = max2; + root[l][r] = r; + } + k=l+1; + while (k dp[l][r]) { + dp[l][r] = tmp; + root[l][r] = k; //记录根 + } + k=k+1; + } + return dp[l][r]; +} + +int main() { + int i; + + n = getint(); + + i=1; + while (i<=n) { + a[i] = getint(); + dp[i][i] = a[i]; //分数 + root[i][i] = i; //根节点 + i=i+1; + } + putint(solve(1,n)); + output(1,n); //输出前序遍历 + return 0; +} \ No newline at end of file diff --git a/tests/upload/test5_1.in b/tests/upload/test5_1.in new file mode 100644 index 0000000..20b821d --- /dev/null +++ b/tests/upload/test5_1.in @@ -0,0 +1,73 @@ +9999 1000 +9999 8227 1868 4728 8254 778 5282 4051 5444 3263 378 8492 8912 5889 + 1325 56 4984 6978 9079 8802 4326 5502 627 5044 1139 9190 4912 5571 + 6922 3951 7649 3261 7969 4053 8251 5680 6632 4110 2322 7944 4273 1618 + 2598 4366 9998 4833 7111 2624 7968 6306 46 9318 9625 6163 8718 1855 + 7484 4679 2771 7544 2506 5980 2603 9466 7869 3048 6093 6053 189 9257 + 3535 3415 4931 2446 7773 4814 9329 3934 3748 2536 9569 1888 4779 6902 + 4257 9893 1601 9716 8503 7814 1160 340 1247 2870 8018 3074 4654 1902 + 1742 8499 5878 3282 2856 9590 9696 4518 3510 814 425 3977 5609 2526 + 2096 6324 9630 7903 2035 3936 1235 3137 440 2327 8984 6871 8426 8504 + 8934 2163 3906 3179 6882 7181 7945 1895 3037 9177 1949 5717 5853 9945 + 6978 686 4743 2574 3808 3398 4918 7318 3463 2202 8936 6514 2701 8044 + 9223 4862 4322 1933 9067 1553 8695 6581 6999 8636 3283 494 6218 5913 + 8691 180 532 8378 3250 6265 7744 6115 9306 1683 8561 841 742 6185 + 2870 6403 7485 2897 3610 5674 5552 8937 6963 4246 4271 4611 5984 2675 + 3494 8931 1318 4318 3932 6254 139 8698 9436 2256 1169 9372 278 9542 + 4155 5369 6569 3148 598 9786 7327 5609 1572 1045 2688 2433 4884 4708 + 2481 6452 8953 6980 2862 3066 4307 3079 3566 8302 6811 2598 9273 3920 + 2589 6916 3182 2713 9704 3426 5331 1741 6852 2506 3113 6508 6096 2824 + 3346 7086 6439 9952 3169 2274 7093 3302 828 2434 8618 5171 3521 5594 + 576 310 7157 7829 5522 9021 4318 1391 5292 5817 2030 474 2731 5003 + 7001 4340 6346 1406 2968 1243 2345 7672 9236 4521 5179 7854 2309 2666 + 1572 3417 5519 9526 253 3267 2040 9916 2083 3773 3370 29 221 1641 + 135 7091 2223 9309 976 8125 6551 831 8930 6475 5997 6728 5144 3306 + 3220 9459 8255 8481 1985 7279 9625 9076 6247 4960 2009 6913 8584 3884 + 4198 6689 9003 1797 3098 4133 3509 8933 5034 1567 9201 688 3525 8105 + 1346 8173 6902 9809 6653 5412 7679 8244 7910 8085 2278 2660 3077 6996 + 5097 8534 2429 4912 6093 9901 9989 7401 7827 8445 1074 4674 1101 6613 + 7591 9669 9722 1022 6258 6707 7093 4454 6490 4566 6072 6138 3273 8910 + 5995 9952 8816 4094 8003 2334 7471 7810 1039 5194 5912 2433 5241 6117 + 5970 3661 1203 1430 2183 2517 9855 3191 8527 7227 9770 8273 6735 645 + 1056 5305 1480 2810 2419 5414 9753 5763 2125 1876 6629 1647 5734 9887 + 7843 5358 8490 1165 6171 9484 2065 6544 6486 1599 8434 357 3636 4124 + 6276 6936 4924 9554 9651 3787 6216 685 2092 259 678 3316 5168 6082 + 8450 3019 6865 3474 7011 2920 8882 8463 9905 2940 692 4350 6087 899 + 1690 4523 5455 6604 5670 8542 4489 5839 2355 8058 181 1125 9671 5957 + 8096 4564 3896 6829 3305 1805 2917 4249 5405 7391 8937 6477 8236 3403 + 5143 1499 2357 5463 1482 3257 7376 6982 4739 9644 499 4996 5791 8455 + 2360 9961 1913 6333 8636 4528 5141 7507 9444 3101 1100 8199 8606 7682 + 9726 1698 841 9112 5601 3117 2246 2062 2564 5528 139 2109 6508 947 + 1931 5464 4154 4743 4240 9266 703 9030 4426 6456 9911 9435 7720 5189 + 9297 3882 9071 449 1754 1428 6425 5549 3983 1245 1107 8711 8459 428 + 7801 3662 343 1566 5493 9142 7114 2636 8324 1704 8958 8683 9923 2294 + 4747 5296 4898 1685 4171 5229 1538 9883 8848 7810 5308 3539 1946 6385 + 9481 3501 9356 8156 7783 7435 3153 4690 5439 8216 711 2718 377 2734 + 2859 3542 2372 3530 4638 310 2478 7438 9483 6110 8882 8412 2572 4024 + 3150 6060 2235 6481 5436 8405 1722 3414 7778 8715 9447 5096 9256 7900 + 1944 1851 1313 9155 3908 9554 2859 5472 9630 2522 1025 9210 6418 6951 + 478 3544 6428 6614 6312 4545 3183 9725 8375 3912 3763 8074 1850 9502 + 8459 5484 4484 8507 5157 6382 5936 3164 7254 7697 9119 3408 1213 7254 + 2001 9274 9098 7288 1684 6796 8014 72 6661 2388 3967 5038 4420 2037 + 164 2484 7701 7162 7067 734 7017 840 3349 4182 6195 3709 4089 7272 + 2619 5567 9263 1142 7830 9361 9274 3995 3053 5941 1259 8626 8582 6582 + 8221 1291 3313 206 8846 9299 7825 6937 2161 5336 6436 9702 999 6136 + 7647 6726 9571 4953 4077 8436 9492 8339 2325 3270 258 7812 1212 4783 + 2115 2470 7532 6233 3872 848 8062 6062 8235 9590 9257 3143 8741 4012 + 1404 7277 5326 3909 7693 2086 5008 219 7343 4813 5422 2096 4075 6349 + 9731 6384 9176 4125 71 596 1345 10 2803 6252 6559 2720 9049 212 + 2609 1503 3253 536 4956 1098 6938 849 982 8185 273 4584 6285 8863 + 4106 9380 412 9248 1664 2696 5113 9655 2161 5211 6348 6883 7560 9488 + 8507 9308 5036 8872 3217 1571 6153 8987 7551 8973 3432 9907 1261 6786 + 5061 5095 5370 2665 1394 9874 5725 1540 8015 2137 1262 8961 4551 8576 + 2417 9697 2444 404 2174 98 5352 4207 5244 5830 1458 585 3195 1548 + 2039 3932 2642 4950 6824 415 9482 7800 6652 8547 5465 471 4376 1270 + 140 8815 92 8104 4826 6707 2837 1096 2766 2544 2166 8758 9252 9029 + 8764 3998 8502 774 2429 3666 5688 4401 7762 6231 5259 3703 7723 9796 + 6739 1779 6393 7453 3844 7685 9564 1558 6394 2656 9233 7733 3088 7143 + 8469 4437 2164 7531 9774 2619 5963 9896 4588 8125 978 5756 9150 4160 + 1276 6055 6341 6425 2074 9034 1378 389 1752 5102 6911 184 4744 7837 + 5280 1351 3881 8597 9434 8549 2360 4956 1388 9462 4129 2048 9779 8507 + 1151 7140 5801 2431 6402 6637 9814 540 3494 6552 4437 7760 1337 4714 + 9539 7277 7185 3701 5838 9285 4999 3524 1766 4130 3487 4616 9829 3913 + 7150 3896 3532 3191 9521 8207 \ No newline at end of file diff --git a/tests/upload/test5_1.out b/tests/upload/test5_1.out new file mode 100644 index 0000000..0478d4c --- /dev/null +++ b/tests/upload/test5_1.out @@ -0,0 +1,2 @@ +00000592300002593000026300000046430918700000000000000000000000001990000000000000000011290000000000000000000009377228700000000000000062632953000000000003079000000000000000000005147000000000000000000000003533000106938330000000064815647000000000000000000000797000943701789000004391000083290000000000000000000000000000000000000000635900000421120530000000003361000000000000000000001607000000109138107610007691006373000000000000000000000000000000051670000000000000000000000000086270883700008123000000000000000000828700000009749000000000047938443000000000000000094190000000239900000000051190163750770000000000000519700699100000000001087904900000000000000000000000000355900000000000008831000006481000000079700748100000053030000000000316900000088870029690023090000000000000000000000000000000000053930259100000020530000000000000000000000000000000081670003391000000000000000000000000098330000000035900000097100005563064730000000009209000000000000012770000000079070000000000016270982900000065630000000000000001367000000000035343630290000013010003863088190656977410175300000283700000000000000000000000000000000000000000027770521000004261000000028570000033430080904790000880300000000058790000000000000000000000000000000000770300000000002683000109700000000000000009293000000390700000000000000000000000000 +0 \ No newline at end of file diff --git a/tests/upload/test5_1.sy b/tests/upload/test5_1.sy new file mode 100644 index 0000000..6fddc7e --- /dev/null +++ b/tests/upload/test5_1.sy @@ -0,0 +1,40 @@ +int isPrime[100005]; +int prime[10005]; + +int main() +{ + int n; + int q; + int k; + int cnt; + int i; + int j; + + n = getint(); + q = getint(); + + cnt = 1; + i=2; + while (i<=n) { + if (isPrime[i] == 0) { + prime[cnt] = i; + cnt = cnt+1; + } + j=1; + while (jb){ + return a; + }else{ + return b; + } +} +int Factorial(int n) +{ + if(n==zzzz[1]) + return 1; + else + return n*Factorial(n-1); +} +int gets1(int var1,int var2){ + int change1; + change1 = var1 * var2; + return change1; +} +int gets2(int var1,int var2){ + int change1; + change1 = var1 / var2; + return change1; +} +int change(int Q) +{ + int i,j; + i = +xx[10]; + j = 0; + while(j<=i){ + Q=Q-am/xx[2]+1; + i=i-1; + j=j+2; + } + return Q; +} + +const int alpha = 0x2a,a=0172; +int main() +{ + const int sadf=100; + const int ffff=10; + int Total,i; + Total=10; + int number1,number2,number3; + i=getarray(z)-3; //有问题 + number1=z[1]; + number2=z[2]; +number3=0x66; +putint(Total/2+a-sadf/ffff); + int result[10][10],j,k; + j=10; + k=i-0; + result[0][0]=-i/2+Total*alpha-number3; + putint(result[0][0]); + putch(32); + result[0][1] = gets1(Ac,am)+gets2(am,Ac); + putint(result[0][1]); + putch(32); + while(1<2){ + k=k+1; + result[0][k]=change(k); //这里有问题 + if(change(-result[0][k])<=-2){ + break; + } + } + putf("%d ",k); +putf("%d ",result[0][1]); + putf("%d ",result[0][2]); + while(number3!=compare(number1,number2)){ + number3=number3-1; + j=j-1; + if(result[0][j]>Total/2+k){ + result[0][j]=Total/2+k; + } + } +putf("%d ",Factorial(j)); + int b; + b=Factorial(B); //有问题,因为查不到b变量(block不相等) + // while(!(xx[3]>zzzz[4])||1==1){ + while(zzzz[1]==xx[1]){ + //int Total=1; + if(b>(18*1-0)){ + b=b-10; + i=i+Total; + }else{ + break; + } + } + + putf("%d ",i); +putf("%d ",Factorial(B)%Factorial(B-1)); + return i; +} -- cgit v1.2.3