-
Notifications
You must be signed in to change notification settings - Fork 1
/
P06_DnaSequences.java
37 lines (35 loc) · 1.13 KB
/
P06_DnaSequences.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.text.MessageFormat;
import java.util.Scanner;
/**
* Created by todor on 1.06.2017 г..
*/
public class P06_DnaSequences {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int dnaSum = Integer.parseInt(scan.nextLine());
char[] dna = new char[] { 'O', 'A', 'C', 'G', 'T', 'X' };
int counter = 0;
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 4; j++)
{
for (int k = 1; k <= 4; k++)
{
counter++;
if (i + j + k >= dnaSum)
{
System.out.print(MessageFormat.format("{0}{1}{2}{3}{0} ", dna[0], dna[i], dna[j], dna[k]));
}
else
{
System.out.print(MessageFormat.format("{0}{1}{2}{3}{0} ", dna[5], dna[i], dna[j], dna[k]));
}
if (counter % 4 == 0)
{
System.out.println();
}
}
}
}
}
}