質問編集履歴

2

小数点問題修正・解決

2019/11/05 11:37

投稿

NIKONIKONIKONIK
NIKONIKONIKONIK

スコア83

test CHANGED
File without changes
test CHANGED
@@ -62,7 +62,7 @@
62
62
 
63
63
  if(0 <= p && q <= 100){
64
64
 
65
- double s = m - (100 - p); //変更
65
+ double s = m - (100 - p) * 0.01; //変更
66
66
 
67
67
  double ss = s * (q * 0.01);
68
68
 

1

指摘されました点を理解したうえで変更しました。

2019/11/05 11:37

投稿

NIKONIKONIKONIK
NIKONIKONIKONIK

スコア83

test CHANGED
File without changes
test CHANGED
@@ -62,13 +62,13 @@
62
62
 
63
63
  if(0 <= p && q <= 100){
64
64
 
65
- double s = m - (p * 0.01);
65
+ double s = m - (100 - p); //変更
66
66
 
67
67
  double ss = s * (q * 0.01);
68
68
 
69
69
  double sss = s - ss;
70
70
 
71
- System.out.println(String.format("%.2f", sss));
71
+ System.out.println(String.format("%.1f", sss));
72
72
 
73
73
  }
74
74