题解 | #翻转翻转#
翻转翻转
https://www.nowcoder.com/practice/ad11db28e0f44a1c97af06fd002477a1
#include<iostream> #include<climits> #include<vector> #include<algorithm> #include<numeric> #include <string> using namespace std; int main(){ int T; cin>>T; long long m,n; while(T--){ cin>>m>>n; if(m==1||n==1){ int big=max(m,n); if(big==1) cout<<1<<endl; else if(big>=2){ cout<<big-2<<endl; } }else{ cout<<(m-2)*(n-2)<<endl; } } system("pause"); return 0; }