题解 | #翻转翻转#

翻转翻转

http://www.nowcoder.com/practice/ad11db28e0f44a1c97af06fd002477a1

import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int num = sc.nextInt();
        for(int i = 1; i <= num; i++){
            long n = sc.nextLong();
            long m = sc.nextLong();
            long s ;
            if(n == 1 && m == 1){
                s = 1;
            }else if(n == 1){
                s = m - 2;
            }else if(m == 1){
                s = n - 2;
            }else{
                s = (n - 2) * (m - 2);
            }
            System.out.println(s);
        }

    }
}
全部评论

相关推荐

程序员小白条:你是沟通了900个,不是投了900份简历,你能投900份,意味着对面都要回复你900次,你早就找到实习了,没亮点就是这样的,别局限地区,时间投的也要早,现在都要7月了
点赞 评论 收藏
分享
06-19 19:06
门头沟学院 Java
码农索隆:别去东软,真学不到东西,真事
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务