当前位置: 首页 > news >正文

做百度推广需要有网站吗会展公司排名

做百度推广需要有网站吗,会展公司排名,做视频网站对服务器要去,怎样进行网站建设题意#xff1a;给你一个给你一个矩阵#xff0c;有黑白两个状态。每次你可以选择一个变为其相反的状态#xff0c;它周围的4个都会变成相反的状态。问你最少需要改变多少个使得矩阵中的状态全为白色#xff0c;若有多个答案#xff0c;输出字典序最小的 思路#xff1a…题意给你一个给你一个矩阵有黑白两个状态。每次你可以选择一个变为其相反的状态它周围的4个都会变成相反的状态。问你最少需要改变多少个使得矩阵中的状态全为白色若有多个答案输出字典序最小的 思路白书p153 题解这个题仍然是个反转问题,我们只需要枚举第一行(二进制)进行翻转的坐标 然后根据当前这块上面那块是否是黑色依据该块上面本来是什么以及周围或者自身总共反转了多少次确定最后得出该块是否需要反转 最后只需要特判最后一行是否合理即全为白色并进行维护更新答案即可。 另外其实每个点最多只会被翻转一次因为如果翻转两次和不翻转是一样的。 Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M≤ 15; 1 ≤ N ≤ 15) of square tiles, each of which is colored black on one side and white on the other side. As one would guess, when a single white tile is flipped, it changes to black; when a single black tile is flipped, it changes to white. The cows are rewarded when they flip the tiles so that each tile has the white side face up. However, the cows have rather large hooves and when they try to flip a certain tile, they also flip all the adjacent tiles (tiles that share a full edge with the flipped tile). Since the flips are tiring, the cows want to minimize the number of flips they have to make. Help the cows determine the minimum number of flips required, and the locations to flip to achieve that minimum. If there are multiple ways to achieve the task with the minimum amount of flips, return the one with the least lexicographical ordering in the output when considered as a string. If the task is impossible, print one line with the word IMPOSSIBLE. Input Line 1: Two space-separated integers: M and N  Lines 2.. M1: Line i1 describes the colors (left to right) of row i of the grid with Nspace-separated integers which are 1 for black and 0 for white Output Lines 1.. M: Each line contains N space-separated integers, each specifying how many times to flip that particular location. Sample Input 4 4 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 Sample Output 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 #includestdio.h #includestring.h using namespace std; const int M110; int m,n; int mp[M][M]; int s[M][M];//保存中间结果 int w[M][M];///保存最优解,s,w记录的都是翻动操作 int e[5][2] {0,0,0,1,1,0,-1,0,0,-1};//领接格子的坐标包括本身 int f(int x,int y)//查询x,y的颜色判断该点是否为黑色 {int xxmp[x][y];for(int i0; i5; i){int uxe[i][0],vye[i][1];if(u0umv0vn)xxs[u][v];}return xx%2; } int bfs()//求出第一行确定情况下的最小操作不存在解的话返回-1 {int ant0;for(int i1; im; i)//求出从第二行开始翻转for(int j0; jn; j)//上方格子是黑色必须必须反转i,j号格子if(f(i-1,j))s[i][j]1;for(int i0; in; i)//判断最后一行是否全白if(f(m-1,i))return -1;for(int i0; im; i)//统计翻转的次数for(int j0; jn; j)ants[i][j];return ant; } void solve() {int ans0x3f3f3f3f;for(int i0; i(1n); i)//按字典序尝试第一行的所有可能性{memset(s,0,sizeof(s));for(int j0; jn; j)//给第一行各个位置是否翻动按字典序赋值s[0][n-j-1]ij1;int numbfs();if(num0ansnum){ansnum;memcpy(w,s,sizeof(s));//把dp数组复制给s数组int数组的复制memcpy}}if(ans0x3f3f3f3f)printf(IMPOSSIBLE\n);else{for(int i0; im; i)///输出翻动操作{for(int j0; jn-1; j)printf(%d ,w[i][j]);printf(%d\n,w[i][n-1]);}} } int main() {while(~scanf(%d%d,m,n)){memset(w,0,sizeof(w));for(int i0; im; i)for(int j0; jn; j)scanf(%d,mp[i][j]);solve();}return 0; }
http://www.huolong8.cn/news/322215/

相关文章:

  • wordpress 使用七牛免费网站建设seo
  • 做网站拍幕布照是什么意思网站策划的最终体现是撰写网站策划书
  • 网站内链wordpress插件网站设计公司北京
  • 网站开发外文文献大连网站优化方案
  • 网站建设人员任职要求wordpress免费博客主题
  • 手机论坛网站怎么做网络营销概论
  • 个人信息查询新站seo优化快速上排名
  • 怎么做网站静态布局南昌网站开发培训中心
  • c语言网站开发许昌做网站联系电话
  • 做优惠卷网站网站建设主页
  • 滁州金鹏建设集团网站权威发布图片大全
  • 中国网站建设服务中心在线代理网页浏览
  • 三合一网站建站利用小米路由器mini做网站
  • 做go kegg的网站做游戏模型挣钱的网站
  • 网站做统计分析打开网站notfound
  • 网站报价自己网上怎么接单
  • 网站已经开发怎样用微信实现手机网站开发千万不要学数字媒体技术
  • 购物网站的前台用什么做建站系统破解源码
  • 手机网站怎么做淘宝客wordpress政企网站
  • 建设部网站统计网站推广主要方法
  • 兴安盟网站建设网络广告名词解释
  • 网站代码素材建设品牌推广工作职责
  • 培训机构停课烟台seo做的好的网站
  • 自己制作网站的步骤广州建网站站公司
  • app开发导入网站模板wordpress视频插件w
  • 青海省建设厅查询网站wordpress如何撤销301
  • 网站设计 网站推广 网站优化怎么制作平台
  • 站长工具在线查询婴儿睡袋网站建设
  • 中国哪家网站做仿古做的好nginx 网站建设
  • 网站二级分类长沙装修公司名单