Skip to content

Commit

Permalink
fix D808 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
microtony committed Sep 23, 2016
1 parent 03bc565 commit d16c7e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions exercises/D808/solution.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ int ans;
void sort(int l, int r) {
ans += r - l + 1;
if (l >= r) return ;
int t, i, j, p;
p = a[r];
i = l;
for (j = l; j <= r - 1; j++) {
Expand All @@ -17,6 +18,8 @@ void sort(int l, int r) {
t = a[i];
a[i] = a[r];
a[r] = t;
sort(l, i - 1);
sort(i + 1, r);
}
int main() {
int n, i, j, p, t;
Expand Down
2 changes: 1 addition & 1 deletion exercises/D808/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
["10\n0 0 0 0 0 0 0 0 0 0\n", "0 0 0 0 0 0 0 0 0 0\n55\n"],
["10\n1 2 3 4 5 6 7 8 9 10\n", "1 2 3 4 5 6 7 8 9 10\n55\n"],
["10\n10 9 8 7 6 5 4 3 2 1\n", "1 2 3 4 5 6 7 8 9 10\n55\n"],
["10\n3 6 10 1 7 2 8 5 6 4\n", "1 2 3 4 5 6 7 8 9 10\n29\n"],
["10\n3 9 10 1 7 2 8 5 6 4\n", "1 2 3 4 5 6 7 8 9 10\n30\n"],
5
]

0 comments on commit d16c7e1

Please sign in to comment.