Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class ProgramerDNA
- {
- static void Main()
- {
- char[] dna = { 'A', 'B', 'C', 'D', 'E', 'F', 'G' };
- int length = int.Parse(Console.ReadLine());
- char startingLetter = char.Parse(Console.ReadLine());
- int dnaindex = startingLetter - 65;
- for (int i = 0; i < length; i++)
- {
- int row = i % 7 + 1;
- switch (row)
- {
- case 1: Console.WriteLine("{0}{1}{0}", new string('.', 3), dna[dnaindex % 7]); dnaindex++; break;
- case 2: Console.WriteLine("{0}{1}{2}{3}{0}", new string('.', 2), dna[dnaindex % 7], dna[(dnaindex + 1) % 7], dna[(dnaindex + 2) % 7]); dnaindex += 3; break;
- case 3: Console.WriteLine("{0}{1}{2}{3}{4}{5}{0}", new string('.', 1), dna[dnaindex % 7], dna[(dnaindex + 1) % 7], dna[(dnaindex + 2) % 7], dna[(dnaindex + 3) % 7], dna[(dnaindex + 4) % 7]); dnaindex = dnaindex + 5; break;
- case 4: Console.WriteLine("{0}{1}{2}{3}{4}{5}{6}", dna[dnaindex % 7], dna[(dnaindex + 1) % 7], dna[(dnaindex + 2) % 7], dna[(dnaindex + 3) % 7], dna[(dnaindex + 4) % 7], dna[(dnaindex + +5) % 7], dna[(dnaindex + 6) % 7]); dnaindex = dnaindex + 7; break;
- case 5: Console.WriteLine("{0}{1}{2}{3}{4}{5}{0}", new string('.', 1), dna[dnaindex % 7], dna[(dnaindex + 1) % 7], dna[(dnaindex + 2) % 7], dna[(dnaindex + 3) % 7], dna[(dnaindex + 4) % 7]); dnaindex = dnaindex + 5; break;
- case 6: Console.WriteLine("{0}{1}{2}{3}{0}", new string('.', 2), dna[dnaindex % 7], dna[(dnaindex + 1) % 7], dna[(dnaindex + 2) % 7]); dnaindex += 3; break;
- case 7: Console.WriteLine("{0}{1}{0}", new string('.', 3), dna[dnaindex % 7]); dnaindex = dnaindex + 1; break;
- default: ; break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement