close

Вход

Забыли?

вход по аккаунту

?

отчет2

код для вставкиСкачать
 ???????????? ?????? ? ?????, ?????? ?? ?????? ???????
????????????? ????????? ??????????? ????? ????? ??????
????????? ????'??????? ????
??????? ??????????????? ????????????? ??????
????
? ???????????? ?????? ?2
"???????? ?????? ?????"
?????????? "?????? ?????????? ?? ??????????? ??????"
????????????? "?????????????? ??????? ????????? ??????"
6.050101-??.??.02-303.2910302
???????___________?.?.??????? (??????)
____________
(????)
????????___________?.?.?????????
(??????)
____________
(????)
???????? - 2012
??????? 1
?????????? ?????? ?????, ??? ???????? ???????: y = n_1+n_2+n_3+n_4+n_5+n_6
?????????? ?????? ????? ?? ????????? ??????????? ????????? ????2000:
???i???
?n_1n_2n_3n_4n_5n_61222222 ?????????? ?????? ????? ?? ????????? ??????????? ????????? ????2000:
????????:
????? ??????? ?????. ???????? ????? ?????
????? ????? ??????? ?????
??????? ????? ?? ???????? ???????? ????????? ?? ???????? ?????????? ????? 1-5.
??????? ????????: public class Main {
static void post(char[] tape, String[][] command) {
int numberCommand = 0;
char curCommand = 0;
int currentSymbol = 1;
String cmd = "";
boolean flag;
while ( currentSymbol<tape.length) {
curCommand = command[numberCommand][0].toCharArray()[0];
switch (curCommand) {
case '>':
currentSymbol++;
numberCommand++;
break;
case '<':
currentSymbol--;
numberCommand++;
break;
case '?':
cmd = command[numberCommand][1];
if (tape[currentSymbol] == '0') {
numberCommand = Integer.parseInt(cmd.substring(0, cmd.indexOf(",")));
} else {
numberCommand = Integer.parseInt(cmd.substring(cmd.indexOf(",") + 1));
}
break;
case 'V':
tape[currentSymbol] = '1';
numberCommand++;
System.out.println(tape);
break;
case 'I':
tape[currentSymbol] = '0';
numberCommand++;
System.out.println(tape);
break;
}
}
}
public static void main(String[] args) {
String tp = "0110110110110110110";
String command[][] = {{"I", "1"},{"<", "2"},{"?", "3,1"},{">", "4"},
{"I", "5"},{">", "6"},{"?", "7,5"},{"V", "8"},{">", "9"},{"?", "10,2"},{"!",""}};
char[] tape = tp.toCharArray();
post(tape, command);
}
}
?????????:
Документ
Категория
Без категории
Просмотров
6
Размер файла
449 Кб
Теги
отчет
1/--страниц
Пожаловаться на содержимое документа