Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class example {
- public static void main(String[] args) throws IOException {
- BufferedReader reader =
- new BufferedReader(new InputStreamReader(System.in));
- char lastSector = reader.readLine().charAt(0);
- int firstSectorRows = (Integer.parseInt(reader.readLine()));
- int placesInOddRow = (Integer.parseInt(reader.readLine()));
- int placesInEvenRow = placesInOddRow+2;
- int allPlace =0;
- for (int i = 65; i <= lastSector ; i++) {
- for (int j = 1; j <=firstSectorRows ; j++) {
- if (j%2==0){
- for (int k = 97; k < 97 + placesInEvenRow; k++) {
- char sector = (char)i;
- int row = j;
- char place = (char)k;
- String stringForOutPut = String.format("%s%d%s",sector,row,place);
- System.out.println(stringForOutPut);
- allPlace++;
- }
- }else {
- for (int k = 97; k < 97 + placesInOddRow; k++) {
- char sector = (char)i;
- int row = j;
- char place = (char)k;
- String stringForOutPut = String.format("%s%d%s",sector,row,place);
- System.out.println(stringForOutPut);
- allPlace++;
- }
- }
- }
- firstSectorRows++;
- }
- System.out.println(allPlace);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement