fork download
  1. public class Main {
  2. public static void main (String[] args) {
  3. double[] consts = {5.0D, 6.0D, 6.8D};
  4. System.out.println("$5.00\t$6.00\t$6.80");
  5. for (int x = 1; x < 100; x++) {
  6. for (int y = 1; y < 100; y++) {
  7. for (int z = 1; z < 100; z++) {
  8. if (gcf(x, y, z) == 1 && (consts[0]*x + consts[1]*y + consts[2]*z)/(x + y + z) == 6.5) {
  9. System.out.println(x + "\t" + y + "\t" + z);
  10. }
  11. }
  12. }
  13. }
  14. }
  15.  
  16. public static int gcf(int a, int b) {
  17. if (b == 0) {
  18. return a;
  19. } else {
  20. return gcf(b, a%b);
  21. }
  22. }
  23.  
  24. public static int gcf(int a, int b, int c) {
  25. return gcf(gcf(a, b), c);
  26. }
  27. }
Success #stdin #stdout 0.14s 245824KB
stdin
Standard input is empty
stdout
$5.00	$6.00	$6.80
1	3	10
1	6	15
1	9	20
1	12	25
1	15	30
1	18	35
1	21	40
1	24	45
1	27	50
1	30	55
1	33	60
1	36	65
1	39	70
1	42	75
1	45	80
1	48	85
1	51	90
1	54	95
2	3	15
2	9	25
2	15	35
2	21	45
2	27	55
2	33	65
2	39	75
2	45	85
2	51	95
3	3	20
3	6	25
3	12	35
3	15	40
3	21	50
3	24	55
3	30	65
3	33	70
3	39	80
3	42	85
3	48	95
4	3	25
4	9	35
4	15	45
4	21	55
4	27	65
4	33	75
4	39	85
4	45	95
5	3	30
5	6	35
5	9	40
5	12	45
5	18	55
5	21	60
5	24	65
5	27	70
5	33	80
5	36	85
5	39	90
5	42	95
6	3	35
6	15	55
6	21	65
6	33	85
6	39	95
7	3	40
7	6	45
7	9	50
7	12	55
7	15	60
7	18	65
7	24	75
7	27	80
7	30	85
7	33	90
7	36	95
8	3	45
8	9	55
8	15	65
8	21	75
8	27	85
8	33	95
9	3	50
9	6	55
9	12	65
9	15	70
9	21	80
9	24	85
9	30	95
10	3	55
10	9	65
10	21	85
10	27	95
11	3	60
11	6	65
11	9	70
11	12	75
11	15	80
11	18	85
11	21	90
11	24	95
12	3	65
12	15	85
12	21	95
13	3	70
13	6	75
13	9	80
13	12	85
13	15	90
13	18	95
14	3	75
14	9	85
14	15	95
15	3	80
15	6	85
15	12	95
16	3	85
16	9	95
17	3	90
17	6	95
18	3	95