2014-09-28

11044 - Searching for Nessy


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1985


import java.util.*;

public class Main {

 public static void main(String[] args) {
  Scanner scan = new Scanner(System.in);
  int cases = scan.nextInt();
  while(cases--!=0){
   int r = scan.nextInt();
   int c = scan.nextInt();
   r-=2;
   c-=2;
   int $r,$c;
   if(r%3!=0)
    $r=r/3+1;
   else
    $r=r/3;
   if(c%3!=0)
    $c=c/3+1;
   else
    $c=c/3;
   System.out.println($r*$c);
  }
 }

}

沒有留言:

張貼留言

(VM) Ubuntu enable ssh

OS版本:14.04 LTS 相關指令: sudo apt-get install openssh-server Port forwarding設定 : 以virtual box為例子,網路->進階->連接阜轉送(port forwarding)