hdoj 2285 Switches 高斯消元。。。
来源:互联网 发布:java记录日志的方式 编辑:程序博客网 时间:2024/06/08 15:59
#include<cstdio>#include<algorithm>#include<iostream>#include<cstring>using namespace std;int init[205][205],a[205][205];int n,m;char s[200],s1[205];void debug(){ for(int i=0;i<n;i++) { for(int j=0;j<=m;j++) printf("%d ",a[i][j]); printf("\n"); } printf("\n");}bool gaoSi(){ // debug(); int i=0,j=0; for(;i<n&&j<m;j++) { int k; for(k=i;k<n;k++) if(a[k][j])break; if(a[k][j]) { for(int r=0;r<=m;r++)swap(a[i][r],a[k][r]); for(int k=0;k<n;k++) if(a[k][j]&&k!=i) for(int r=0;r<=m;r++)a[k][r]^=a[i][r]; i++; } } //debug(); // printf("%d\n",i); for(;i<n;i++)if(a[i][m])return 0; return 1;}int main(){ while(scanf("%d%d",&n,&m)!=EOF) { memset(a,0,sizeof(a)); memset(init,0,sizeof(init)); for(int i=0;i<m;i++) { scanf("%s",s); for(int j=0;j<n;j++) init[j][i] = s[j]-'0'; } int q; scanf("%d",&q); while(q--) { for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j] = init[i][j]; scanf("%s",s); scanf("%s",s1); for(int i=0;i<n;i++) a[i][m] = (s[i]-'0')^(s1[i]-'0'); bool flag = gaoSi(); if(flag)printf("Yes\n"); else printf("No\n"); } } return 0;}
0 0
- hdoj 2285 Switches 高斯消元。。。
- Routers & switches
- Mikrotik Switches Vs Cisco Switches
- Preemption Context Switches 和 Synchronization Context Switches
- Switches: Sector copy
- osql and sqlcmd switches
- bootstrap-switches-button
- leaf and spine switches
- Password Recovery for Catalyst Switches
- InstallShield Setup Silent Installation Switches
- Firebird command Tools line switches
- High Performance Switches and Routers
- Google Chrome Command Line Switches
- lightoj1034 Hit the Light Switches
- MySQL and Linux Context Switches
- Average time between log switches on database
- 调优日志切换(Tuning Log Switches)
- show log file info and log switches
- Java 开发模式-----单例模式
- phpredis中文手册——《redis中文手册》 php版
- Android基础知识(9)—Android绘图基础Canvas、Paint
- android_音乐的播放
- Java中的Set集合
- hdoj 2285 Switches 高斯消元。。。
- Educational Codeforces Round 11 D 计算几何
- DP训练笔记
- 批处理获取当前时间
- Unity之触屏控制_实现模型旋转和缩放—Touch类的使用
- C中大端小端的问题
- 自定义标题栏,让自己以后不那么累
- 大数据IMF传奇行动绝密课程第25课:Spark Sort-Based Shuffle内幕彻底解密
- WEB前端-HTML-常用标签