标签:blog return col cout problem eve reverse code color
你最多选两个矩阵反转,问你最后的情况数。
很到位了。
const int N=(int)1e2+10; char mp[N][N]; ll C(ll n,ll m) {ll ret=1; for(ll i=1; i<=m; ++i)ret=ret*(n-i+1)/i; return ret;} signed main() { int n,m; while(~sc("%d%d",&n,&m)) { for(int i=1;i<=n;++i)sc("%s",mp[i]+1); n++,m++; // cout<<C(n,2)<<endl; // cout<<C(m,2)<<endl; ll ans=C(C(n,2)*C(m,2),2);//*C(n,2)*C(m,2)+2*C(n,2)*C(m,2); //ans/=2; ans-=C(n,2)*C(m,2)*(n+m-5); // if(n>=3)ans-=C(n,2)*C(m,2)*(n+m-3); if(m>=4)ans-=C(n,2)*C(m,4)*2; if(n>=4)ans-=C(n,4)*C(m,2)*2; if(n>=3&&m>=3)ans-=C(n,3)*C(m,3)*8; if(n>=3&&m>=3) { ans-=C(n,3)*C(m,3)*4; } pr("%lld\n",ans+1); } return 0; }
标签:blog return col cout problem eve reverse code color
原文地址:https://www.cnblogs.com/--HPY-7m/p/12822636.html