博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 5755 Gambler Bo
阅读量:7212 次
发布时间:2019-06-29

本文共 1252 字,大约阅读时间需要 4 分钟。

可以设n*m个未知量,建立n*m个方程。位置i,j可以建立方程 (2*x[i*m+j]+x[(i-1)*m+j]+x[(i+1)*m+j]+x[i*m+j-1]+x[i*m+j+1])%3=3-b[i][j]; 套了个高斯消元的板子过了。

#pragma comment(linker, "/STACK:1024000000,1024000000")#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;typedef long long LL;const double pi=acos(-1.0),eps=1e-8;void File(){ freopen("D:\\in.txt","r",stdin); freopen("D:\\out.txt","w",stdout);}inline int read(){ char c = getchar(); while(!isdigit(c)) c = getchar(); int x = 0; while(isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); } return x;}const int mod = 3;int exgcd(int a,int b,int &x,int &y){ if(!b){x = 1; y = 0; return a;} else{ int r = exgcd(b,a%b,y,x); y -= x * (a/b); return r; }}int lcm(int a,int b){ int x = 0, y =0; return a / exgcd(a,b,x,y) * b;}const int MAXN=1000;int A[MAXN][MAXN],free_x[MAXN],x[MAXN];void Gauss(int n,int m){ int r,c; for(r=0,c=0;r
abs(A[maxr][c])) maxr = i; if(maxr != r) for(int i=c;i<=m;i++) swap(A[r][i],A[maxr][i]); if(!A[r][c]) continue; for(int i=r+1;i
=0;i--){ x[i] = A[i][m]; for(int j=i+1;j
=0&&a
=0&&b

 

转载于:https://www.cnblogs.com/zufezzt/p/5712819.html

你可能感兴趣的文章
VMware: linux起步提示 memory for crashkernel(0*0 to 0*0)not within permissible
查看>>
使用.NET Framework的配置文件app.config
查看>>
图算法之最小生成树
查看>>
drop table big_table 调试
查看>>
如何把Eclipse工程导入到Android Studio
查看>>
未能正确加载“Microsoft.VisualStudio.Editor.Implementation.EditorPackage”包。
查看>>
Web Design - The Viewport
查看>>
程序员学习能力提升三要素
查看>>
何时使用hadoop fs、hadoop dfs与hdfs dfs命令(转)
查看>>
【Coursera】Third Week(1)
查看>>
管道和重定向笔记
查看>>
C++11 并发指南------std::thread 详解
查看>>
windows下编译chromium浏览器的15个流程整理
查看>>
Android监听返回键、Home键+再按一次返回键退出应用
查看>>
p2p穿透技术
查看>>
BZOJ1841 : 蚂蚁搬家
查看>>
html成绩单表格
查看>>
Coding 初级教程(二)——上传已有项目
查看>>
java 基础
查看>>
【Android】Android6.0发送短信Demo
查看>>