質問編集履歴
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -102,7 +102,7 @@
|
|
102
102
|
|
103
103
|
入力例4くらいの桁まではうまくいくのですが入力例5くらいの桁になってくるとと
|
104
104
|
|
105
|
-
s_int=9572214 t_int=9572213 s_
|
105
|
+
s_int=9572214 t_int=9572213 s_dec = 0.000000 t_dec = 1.000000
|
106
106
|
|
107
107
|
となり整数部がうまくいってない上に繰り上がりもできていない、、、
|
108
108
|
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,17 +132,19 @@
|
|
132
132
|
|
133
133
|
int compare(struct golden x, struct golden y) {
|
134
134
|
|
135
|
-
long long int s_int, t_int;
|
135
|
+
long long int s_int, t_int; //整数部
|
136
|
-
|
136
|
+
|
137
|
-
double s_dec, t_dec, q;
|
137
|
+
double s_dec, t_dec, q; //少数部
|
138
|
-
|
139
|
-
|
140
|
-
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
-
q = ( 1 + sqrt(5))/2;
|
141
|
+
q = ( 1 + sqrt(5))/2; //黄金比
|
142
142
|
|
143
143
|
|
144
144
|
|
145
|
+
//整数部と少数部の分離
|
146
|
+
|
145
|
-
s_int = x.a + (int)(x.b * q);
|
147
|
+
s_int = x.a + (int)(x.b * q);//少数部は切り捨てだからこれで良いと思う
|
146
148
|
|
147
149
|
t_int = y.a + (int)(y.b * q);
|
148
150
|
|