题目传送门

 /*
题意:5种情况对应对应第i或j辆车翻了没
水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次
3: if both cars turned over during the collision.
是指i,j两辆车,而不是全部
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
using namespace std; const int MAXN = 1e2 + ;
const int INF = 0x3f3f3f3f;
int a[MAXN][MAXN];
bool vis[MAXN];
int ans[MAXN]; int main(void) //Codeforces Round #303 (Div. 2) A. Toy Cars
{
//freopen ("A.in", "r", stdin); int n;
while (scanf ("%d", &n) == )
{
memset (vis, false, sizeof (vis));
for (int i=; i<=n; ++i)
{
for (int j=; j<=n; ++j) scanf ("%d", &a[i][j]);
} for (int i=; i<=n; ++i)
{
for (int j=i+; j<=n; ++j)
{
if (a[i][j] == )
{
vis[i] = vis[j] = true;
}
else if (a[i][j] == ) vis[j] = true;
else if (a[i][j] == ) vis[i] = true;
}
} int cnt = ;
for (int i=; i<=n; ++i)
{
if (!vis[i]) ans[++cnt] = i;
}
printf ("%d\n", cnt);
for (int i=; i<=cnt; ++i) printf ("%d%c", ans[i], (i==cnt) ? '\n' : ' ');
} return ;
}

水题 Codeforces Round #303 (Div. 2) A. Toy Cars的更多相关文章

  1. 水题 Codeforces Round #303 (Div. 2) D. Queue

    题目传送门 /* 比C还水... */ #include <cstdio> #include <algorithm> #include <cstring> #inc ...

  2. Codeforces Round #303 (Div. 2) A. Toy Cars 水题

     A. Toy Cars Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem ...

  3. 水题 Codeforces Round #302 (Div. 2) A Set of Strings

    题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...

  4. 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas

    题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {" ...

  5. 水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas

    题目传送门 /* 水题:ans = (1+2+3+...+n) * k - n,开long long */ #include <cstdio> #include <algorithm ...

  6. 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift

    题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...

  7. 构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root

    题目传送门 /* 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 */ #include <cstdio> #include <algori ...

  8. 水题 Codeforces Round #306 (Div. 2) A. Two Substrings

    题目传送门 /* 水题:遍历一边先找AB,再BA,再遍历一边先找BA,再AB,两种情况满足一种就YES */ #include <cstdio> #include <iostream ...

  9. 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table

    题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...

随机推荐

  1. C#高阶与初心:(二)P/Invoke平台调用

    最近某个项目要采集交易终端的信息用于监管,主要厂商给出了API,C++版的...开启hard模式!!! C#调用C++的DLL基本就两种方法:加一个VC++项目包一层,或者使用P/Invoke(平台调 ...

  2. (转)CSS3全局实现所有元素的内边距和边框不增加

    全局设置 border-box 很好,首先它符合直觉,其次它可以省去一次又一次的加加减减 它还有一个关键作用——让有边框的盒子正常使用百分比宽度.但是使用了 border-box 可能会与一些依赖默认 ...

  3. 二分法和牛顿迭代实现开根号函数:OC的实现

    最近有人贴出BAT的面试题,题目链接. 就是实现系统的开根号的操作,并且要求一定的误差,其实这类题就是两种方法,二分法和牛顿迭代,现在用OC的方法实现如下: 第一:二分法实现 -(double)sqr ...

  4. 【HDU 5384】Danganronpa(AC自己主动机)

    看官方题解貌似就是个自己主动机裸题 比赛的时候用kuangbin的AC自己主动机模板瞎搞的,居然A了,并且跑的还不慢.. 存下模板吧 #include<cstdio> #include&l ...

  5. Tomcat 安装与配置规范

    Tomcat 安装 演示版本:8.5.32 安装版 JDK推荐版本:jdk1.8 下载地址:https://tomcat.apache.org/download-80.cgi 安装教程 注意:tomc ...

  6. 几个 PHP 的"魔术常量"

    __LINE__ 文件中的当前行号. __FILE__ 文件的完整路径和文件名.如果用在被包含文件中,则返回被包含的文件名.自 PHP 4.0.2 起,__FILE__ 总是包含一个绝对路径(如果是符 ...

  7. [RK3288][Android6.0] 调试笔记 --- 通用GPIO驱动控制LED【转】

    本文转载自:http://m.blog.csdn.net/kris_fei/article/details/69553422 Platform: ROCKCHIPOS: Android 6.0Kern ...

  8. Vim Vundle YouCompleteMe

    /************************************************************************************** * Vim Vundle ...

  9. 【USACO】The Cow Prom

    [题目链接] 点击打开链接 [算法] tarjan求强连通分量 [代码] #include<bits/stdc++.h> #define MAXN 20005 using namespac ...

  10. FTOUR2 - Free tour II

    传送门 题目翻译的很清楚……似乎点分治的题题目描述都非常简洁. 还是那个操作,一条路径要么全部在一棵子树中,要么经过当前的重心,所以考虑点分治. 首先dfs求出重心的每一棵子树中,有i个黑点的最长路径 ...