質問編集履歴
4
誤字の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
2.) git bash上でコンパイル(MinG
|
31
|
+
2.) git bash上でコンパイル(MinGW/bin/g++.exe hoge.cpp)、実行(./a.exe)しています.
|
32
32
|
|
33
33
|
|
34
34
|
|
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,10 +112,6 @@
|
|
112
112
|
|
113
113
|
int main(){
|
114
114
|
|
115
|
-
printf("hello world");
|
116
|
-
|
117
|
-
|
118
|
-
|
119
115
|
scanf("%d" , &n);
|
120
116
|
|
121
117
|
for(int i = 0; i < n; i++){
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
2.) git bash上でコンパイル、実行しています
|
31
|
+
2.) git bash上でコンパイル(MinGw/bin/g++.exe hoge.cpp)、実行(./a.exe)しています.
|
32
32
|
|
33
33
|
|
34
34
|
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,3 +7,173 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
g++とstd::vectorの相性が悪いのでしょうか?
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
[追記]
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
1.) g++のバージョンは以下の通りです.
|
18
|
+
|
19
|
+
```
|
20
|
+
|
21
|
+
g++ --version
|
22
|
+
|
23
|
+
g++.exe (MinGW.org GCC-6.3.0-1) 6.3.0
|
24
|
+
|
25
|
+
Copyright (C) 2016 Free Software Foundation, Inc.
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
2.) git bash上でコンパイル、実行しています。
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
3.) 実行したプログラムは以下の通りです.シェルソート(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D)を行うプログラムになります.
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```cpp
|
40
|
+
|
41
|
+
#include<cstdio>
|
42
|
+
|
43
|
+
#include<algorithm>
|
44
|
+
|
45
|
+
#include<vector>
|
46
|
+
|
47
|
+
using namespace std;
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
long long cnt;
|
52
|
+
|
53
|
+
int l;
|
54
|
+
|
55
|
+
int A[1000000];
|
56
|
+
|
57
|
+
int n;
|
58
|
+
|
59
|
+
vector<int> G;
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
void insertionSort(int A[], int n , int g){
|
64
|
+
|
65
|
+
for(int i = g; i < n; i++){
|
66
|
+
|
67
|
+
int v = A[i];
|
68
|
+
|
69
|
+
int j = i-g;
|
70
|
+
|
71
|
+
while(j >= 0 && A[j] > v){
|
72
|
+
|
73
|
+
A[j+g] = A[j];
|
74
|
+
|
75
|
+
j -= g;
|
76
|
+
|
77
|
+
cnt++;
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
A[j+g] = v;
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
void shellSort(int A[], int n){
|
90
|
+
|
91
|
+
int h = 1;
|
92
|
+
|
93
|
+
while(h <= n){
|
94
|
+
|
95
|
+
G.push_back(h);
|
96
|
+
|
97
|
+
h = 3*h + 1;
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
for(int i = G.size()-1; i >= 0; i--){
|
104
|
+
|
105
|
+
insertionSort(A, n, G[i]);
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
int main(){
|
114
|
+
|
115
|
+
printf("hello world");
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
scanf("%d" , &n);
|
120
|
+
|
121
|
+
for(int i = 0; i < n; i++){
|
122
|
+
|
123
|
+
scanf("%d" , &A[i]);
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
cnt = 0;
|
130
|
+
|
131
|
+
shellSort(A,n);
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
printf("%d\n", G.size());
|
136
|
+
|
137
|
+
for(int i = G.size()-1; i >= 0; i--){
|
138
|
+
|
139
|
+
printf("%d\n",G[i]);
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
for(int i = 0; i < n; i++){
|
146
|
+
|
147
|
+
printf("%d\n", A[i]);
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
return 0;
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
4.) プログラムを引っ張ってきたサイトはC++の日本語リファレンス(https://cpprefjp.github.io/reference/vector.html)です.
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
5.) 今cmd.exe上で同様にコンパイル・実行してみたところ、実行時に
|
168
|
+
|
169
|
+
```
|
170
|
+
|
171
|
+
プロシージャエントリポイント__gxx_personality_v0がダイナミックライブラリ(a.exeのPATH)から見つかりませんでした。
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
とのエラーダイアログが出ました.
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
今のところ考えつく情報はこれくらいです.よろしくお願いします.
|