andy6804tw
2/22/2017 - 11:11 AM

http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=33316 這題按照公式照打就行了~

import java.util.*;  
public class Main {  
    public static void main(String[] args) {  
        Scanner scn = new Scanner(System.in);  
        int n=scn.nextInt();
        while(n--!=0){
        	int a=scn.nextInt(),b=scn.nextInt(),c=scn.nextInt(),d=scn.nextInt(),e=scn.nextInt(),f=scn.nextInt(),g=scn.nextInt()
        			,h=scn.nextInt(),i=scn.nextInt(),tot=0;
        	tot=a*e*i+d*h*c+g*b*f-c*e*g-b*d*i-a*f*h;
        	System.out.println(tot);
        }
    }
  /*題目:ITSA 第50次月賽 [Problem 2] The Typhoon
    作者:1010
    時間:西元 2017 年 2 月 */
}