codeforces 1151  B

codeforces 1151  B  1600fen

题意:n*m的矩阵,问能否从n行中每行选一个数 异或 大于0

解析:刚开始看没思路,想用dfs跑一遍,看到500的时候打消了这个念头(500^500),

其实很简单,随便找一组数据,让他们异或好,结果是零的话,只要存在每行存在与挑选的那个数不相等的就可以了(不相等的数异或不为0)

 #include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
const int maxn = +;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( int i = a;i <= b;++i)
using namespace std;
int n,m,temp,ki,kj;
int a[maxn][maxn];
int main()
{
// freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
// freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
cin>>n>>m;
for(int i=;i<=n;++i)
{
for(int j=;j<=m;++j)
{
cin>>a[i][j];
}
}
temp=a[][];
for(int i=;i<=n;++i)
{
temp^=a[i][];
}
if(temp>)
{
cout<<"TAK"<<endl;
FOR(i,,n)
{
cout<<<<" ";
}
return ;
}
else
{
for(int i=;i<=n;i++)
{
for(int j=;j<=m;++j)
{
if(a[i][j]!=a[i][])
{
ki=i;
kj=j;
cout<<"TAK"<<endl;
for(int i=;i<=n;++i)
{ if(i==ki)
cout<<kj<<" ";
else cout<<<<" "; }
return ;
} } }
cout<<"NIE"<<endl;
}
}

codeforces 1151 B的更多相关文章

  1. codeforces 1151 D

    SM的水题. codeforces 1151D 当时写对了,因为第一题卡了,,然后这题就没细想,原来是没开longlong. 题意:n个位置每个位置有a和b,让sum=(每个点的左面的点的数量*a+右 ...

  2. codeforces 1151 A

    一个让我爆零的水题,,,,, codeforces 1151A   1000分 题意:一个字符串,单个字符可以一步可以变成左右两个(Z可以变成Y,A),问最低多少步可以产生“ACTG”: 错因:错误的 ...

  3. CodeForces 1151F Sonya and Informatics

    题目链接:http://codeforces.com/problemset/problem/1151/F 题目大意: 给定长度为 n 的 01 序列,可以对该序列操作 k 次,每次操作可以交换序列中任 ...

  4. CodeForces 1151E Number of Components

    题目链接:http://codeforces.com/problemset/problem/1151/E 题目大意: n个人排成一个序列,标号为 1~n,第 i 个人的学习成绩为 ai,现在要选出学习 ...

  5. CodeForces 1151D Stas and the Queue at the Buffet

    题目链接:http://codeforces.com/contest/1151/problem/D 题目大意: 有n个学生排成一队(序号从1到n),每个学生有2个评定标准(a, b),设每个学生的位置 ...

  6. CodeForces 1151C Problem for Nazar

    题目链接:http://codeforces.com/problemset/problem/1151/C 题目大意: 有一个只存奇数的集合A = {1, 3, 5……2*n - 1,……},和只存偶数 ...

  7. CodeForces 1151B Dima and a Bad XOR

    题目链接:http://codeforces.com/contest/1151/problem/B 题目大意: 给定一个n*m的矩阵,里面存放的是自然数,要求在每一行中选一个数,把他们异或起来后结果大 ...

  8. Codeforces Round #553 (Div. 2) D题

    题目网址:http://codeforces.com/contest/1151/problem/D 题目大意:给出n组数对,(ai , bi),调整这n组数对的位置,最小化 ∑(ai*( i -1)+ ...

  9. Codeforces Round #553 (Div. 2) C题

    题目网址:http://codeforces.com/contest/1151/problem/C 题目大意:给定奇数集和偶数集,现构造一个数组,先取奇数集中一个元素1,再取偶数集二个元素2,4,再取 ...

随机推荐

  1. BigDecimal比较大小,BigDecimal判断是否为0

    原文:https://blog.csdn.net/qq_34926773/article/details/83419004 BigDecimal类型的数据,需要比较大小:声明BigDescimal: ...

  2. 遍历一个List的几种方法

    方式1.一开始是这样的: public static void test1(List<String> list) { for (int i = 0; i < list.size(); ...

  3. MySQL Connector/C++ 8.0 源码编译

    平台 ubuntu 16.04 参考文档: https://dev.mysql.com/doc/dev/connector-cpp/8.0/building.html 下载源码 访问 https:// ...

  4. WMI入门教程之WMI中的类在哪里?

    Powershell专栏: https://www.jb51.net/list/list_234_1.htm https://www.pstips.net/get-wmiobject-becomes- ...

  5. mybatis将传入的Integer类型的0被识别成空字符串的问题

    更改mapper文件的sql如下: <if test="interger != null"> interger= #{interger} </if> 原因: ...

  6. web services + soap + wsdl 学习

    什么是web services? 应用程序组件: 使用开放协议进行通信: 独立(self - contained )并可自我描述: 可通过使用UDDI来发现: 可被其他应用程序使用: XML是Web ...

  7. 2018-2019 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2018) - 4.28

    赛后补了几道 赛中我就写了两个... A - Altruistic AmphibiansGym - 101933A 看了眼榜没几个人做.就没看. 最后发现就是一个DP(但是我觉得复杂度有点迷) 题意: ...

  8. Error:Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2

    可以换个maven库: allprojects { repositories { jcenter() //maven { url "https://jitpack.io" } ma ...

  9. java并发编程 | 线程详解

    个人网站:https://chenmingyu.top/concurrent-thread/ 进程与线程 进程:操作系统在运行一个程序的时候就会为其创建一个进程(比如一个java程序),进程是资源分配 ...

  10. linux下python安装

    下载包: wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.gz 解压安装: tar -zvxf  Python-3.6.3. ...