POJ 2695 The Pilots Brothers' refrigerator(神奇的规律)
来源:互联网 发布:js url编码 编辑:程序博客网 时间:2024/06/14 20:03
转载请注明出处:http://blog.csdn.net/a1dark
分析:如果想要将一个“+”翻转成“-”,那么必然会把对应的行和列上的所有点翻转一次、由于一个点翻偶数次就相当于不翻转、所以我需要统计“+”、然后将对应行和列的值+1、最后统计奇数值的个数、便是要翻转的点、
#include<stdio.h>int mpt[5][5];int main(){ char ch; for(int i=1;i<=4;i++){ for(int j=1;j<=4;j++){ scanf("%c",&ch); if(ch=='+'){ mpt[i][j]++; for(int k=1;k<=4;k++){ mpt[i][k]++; mpt[k][j]++; } } } getchar(); } int step=0; for(int i=1;i<=4;i++) for(int j=1;j<=4;j++) if(mpt[i][j]%2!=0) step++; printf("%d\n",step); for(int i=1;i<=4;i++) for(int j=1;j<=4;j++) if(mpt[i][j]%2!=0) printf("%d %d\n",i,j); return 0;}
- POJ 2695 The Pilots Brothers' refrigerator(神奇的规律)
- POJ:2695-The Pilots Brothers' refrigerator
- POJ 2965 The Pilots Brothers' refrigerator(dfs+枚举 || 规律)
- POJ 2965 The Pilots Brothers' refrigerator(dfs or 规律)
- POJ-----2965---The Pilots Brothers' refrigerator---枚举规律
- poj 2965 The Pilots Brothers' refrigerator 飞行员兄弟的冰箱?
- poj-2965-The Pilots Brothers' refrigerator(巧妙的位运算)
- poj 2965 The Pilots Brothers' refrigerator
- POJ 2965 The Pilots Brothers' refrigerator
- poj 2965The Pilots Brothers' refrigerator
- POJ 2965 The Pilots Brothers' refrigerator 枚举
- POJ-2965-The Pilots Brothers' refrigerator
- poj 2965 The Pilots Brothers' refrigerator
- POJ 2965 The Pilots Brothers' refrigerator
- poj 2965 The Pilots Brothers' refrigerator
- poj 2965.The Pilots Brothers' refrigerator
- POJ 2965 The Pilots Brothers' refrigerator
- POJ-2965-The Pilots Brothers' refrigerator
- 链表的冒泡排序
- 最大子序列和
- 字符串最长不含重复字符的子串长度
- hdu 4738 Caocao's Bridges(2013杭州网络赛丶神坑)
- 用interrupt()中断Java线程
- POJ 2695 The Pilots Brothers' refrigerator(神奇的规律)
- Visual Studio 2008 简体中文正式版下载及序列号|让试用版变成正式版
- Eclipse中显示空格(Space)和Tab符的设置
- TF卡,Micro SD卡,Micro SDHC卡
- 最长公共子串 Longest common subString
- hdu 4739 Zhuge Liang's Mines
- js 错误
- 安装lrzsz(zmodem)
- Socket编程