亚洲精品中文字幕无乱码_久久亚洲精品无码AV大片_最新国产免费Av网址_国产精品3级片

IBM認(rèn)證 百分網(wǎng)手機(jī)站

ccf認(rèn)證考試試題答案(2)

時間:2018-03-14 16:14:45 IBM認(rèn)證 我要投稿

ccf認(rèn)證考試試題答案

  int N = fin.nextInt();

  long[] count = new long[8];

  count[6] = 0;

  count[7] = 1;

  long mod = 1000000007;

  for (int i = 2; i <= N; ++i) {

  long[] newCount = new long[8];

  newCount[0] = (count[0] * 2 + count[1] + count[3]) % mod; newCount[1] = (count[1] * 2 + count[2] + count[5]) % mod; newCount[2] = (count[2] + count[6]) % mod;

  newCount[3] = (count[3] * 2 + count[4] + count[5]) % mod; newCount[4] = (count[4] + count[7]) % mod;

  newCount[5] = (count[5] * 2 + count[6] + count[7]) % mod; newCount[6] = 0;

  newCount[7] = 1;

  count = newCount;

  }

  System.out.println(count[0]);

  }

  }

  5.I’m stuck!

  import java.util.*;

  public class Main {

  public static void main(String[] args) {

  new Main().run();

  }

  public void run() {

  Scanner fin = new Scanner(System.in);

  int R = fin.nextInt();

  int C = fin.nextInt();

  fin.nextLine();

  int[][] board = new int[R + 2][C + 2];

  int rowStart = 0, colStart = 0, rowEnd = 0, colEnd = 0; for (int i = 1; i <= R; ++i) {

  String line = fin.nextLine();

  for (int j = 1; j <= C; ++j) {

  char c = line.charAt(j - 1);

  switch (c) {

  case '#': break;

  case '-': board[i][j] = 5; break;

  case '|': board[i][j] = 0xA; break;

  case '+':

  case 'S':

  case 'T':

  board[i][j] = 0xF; break; case '.': board[i][j] = 0x8; break;

  default: break;

  }

  if (c == 'S') {

  rowStart = i;

  colStart = j;

  } else if (c == 'T') {

  rowEnd = i;

  colEnd = j;

  }

  }

  }

  int[] dr = new int[] {0, -1, 0, 1};

  int[] dc = new int[] {1, 0, -1, 0};

  // Scan 1: find all cells which can reach T

  boolean[][] visited = new boolean[R + 2][C + 2]; boolean[][] canReachT = new boolean[R + 2][C + 2]; initVisited(visited);

  canReachT[rowEnd][colEnd] = true;

  visited[rowEnd][colEnd] = true;

  Queue queue = new LinkedList(); queue.add(rowEnd);

  queue.add(colEnd);

  while (!queue.isEmpty()) {

  int r = queue.remove();

  int c = queue.remove();

  for (int i = 0; i < 4; ++i) {

  int nr = r + dr[i];

【ccf認(rèn)證考試試題答案】相關(guān)文章:

1.Oracle認(rèn)證考試

2.微軟認(rèn)證考試技巧:MCSA認(rèn)證考試經(jīng)驗

3.安全生產(chǎn)法試題答案

4.cad考證試題答案

5.國際iq測試題答案

6.學(xué)校安全教育試題答案

7.攜程在線測試題答案

8.SUN認(rèn)證考試簡介