質問編集履歴

4

2019/07/20 12:54

投稿

xxxrrrr
xxxrrrr

スコア17

test CHANGED
File without changes
test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  for(i=0;i<10;i++)
30
30
 
31
- printf("%d",d[i]);
31
+ printf("%d",d[i]);
32
32
 
33
33
  printf("\n\n");
34
34
 

3

2019/07/20 12:54

投稿

xxxrrrr
xxxrrrr

スコア17

test CHANGED
File without changes
test CHANGED
@@ -54,19 +54,19 @@
54
54
 
55
55
  while(d[L]<d[pivot])
56
56
 
57
- L++;
57
+ L++;
58
58
 
59
59
  while(d[pivot]<d[R])
60
60
 
61
- R--;
61
+ R--;
62
62
 
63
63
  if(L<R){
64
64
 
65
- tmp=d[L];
65
+ tmp=d[L];
66
66
 
67
- d[L]=d[R];
67
+ d[L]=d[R];
68
68
 
69
- d[R]=tmp;
69
+ d[R]=tmp;
70
70
 
71
71
  }
72
72
 

2

2019/07/20 12:53

投稿

xxxrrrr
xxxrrrr

スコア17

test CHANGED
File without changes
test CHANGED
@@ -52,33 +52,33 @@
52
52
 
53
53
  while(L<R){
54
54
 
55
- while(d[L]<d[pivot])
55
+ while(d[L]<d[pivot])
56
56
 
57
- L++;
57
+ L++;
58
58
 
59
- while(d[pivot]<d[R])
59
+ while(d[pivot]<d[R])
60
60
 
61
- R--;
61
+ R--;
62
62
 
63
- if(L<R){
63
+ if(L<R){
64
64
 
65
- tmp=d[L];
65
+ tmp=d[L];
66
66
 
67
- d[L]=d[R];
67
+ d[L]=d[R];
68
68
 
69
- d[R]=tmp;
69
+ d[R]=tmp;
70
70
 
71
- }
71
+ }
72
72
 
73
73
  }
74
74
 
75
75
  if(lp<pivot-1)
76
76
 
77
- qui_sort(lp,pivot-1);
77
+ qui_sort(lp,pivot-1);
78
78
 
79
79
  if(pivot+1<rp)
80
80
 
81
- qui_sort(pivot+1,rp);
81
+ qui_sort(pivot+1,rp);
82
82
 
83
83
  }
84
84
 

1

2019/07/20 12:52

投稿

xxxrrrr
xxxrrrr

スコア17

test CHANGED
File without changes
test CHANGED
@@ -24,61 +24,61 @@
24
24
 
25
25
  int main(void){
26
26
 
27
- qui_sort(lp,rp);
27
+ qui_sort(lp,rp);
28
28
 
29
- for(i=0;i<10;i++)
29
+ for(i=0;i<10;i++)
30
30
 
31
- printf("%d",d[i]);
31
+ printf("%d",d[i]);
32
32
 
33
- printf("\n\n");
33
+ printf("\n\n");
34
34
 
35
- system("pause");
35
+ system("pause");
36
36
 
37
- return 0;
37
+ return 0;
38
38
 
39
39
  }
40
40
 
41
41
  void qui_sort(int lp,int rp){
42
42
 
43
- int L,R,pivot;
43
+ int L,R,pivot;
44
44
 
45
- L=lp;
45
+ L=lp;
46
46
 
47
- R=rp;
47
+ R=rp;
48
48
 
49
- pivot=L; //ここを(L+R)/2にするとおかしくなる
49
+ pivot=L; //ここを(L+R)/2にするとおかしくなる
50
50
 
51
51
 
52
52
 
53
- while(L<R){
53
+ while(L<R){
54
54
 
55
- while(d[L]<d[pivot])
55
+ while(d[L]<d[pivot])
56
56
 
57
- L++;
57
+ L++;
58
58
 
59
- while(d[pivot]<d[R])
59
+ while(d[pivot]<d[R])
60
60
 
61
- R--;
61
+ R--;
62
62
 
63
- if(L<R){
63
+ if(L<R){
64
64
 
65
- tmp=d[L];
65
+ tmp=d[L];
66
66
 
67
- d[L]=d[R];
67
+ d[L]=d[R];
68
68
 
69
- d[R]=tmp;
69
+ d[R]=tmp;
70
70
 
71
- }
71
+ }
72
72
 
73
- }
73
+ }
74
74
 
75
- if(lp<pivot-1)
75
+ if(lp<pivot-1)
76
76
 
77
- qui_sort(lp,pivot-1);
77
+ qui_sort(lp,pivot-1);
78
78
 
79
- if(pivot+1<rp)
79
+ if(pivot+1<rp)
80
80
 
81
- qui_sort(pivot+1,rp);
81
+ qui_sort(pivot+1,rp);
82
82
 
83
83
  }
84
84