水题 Codeforces Round #303 (Div. 2) A. Toy Cars
/*
题意: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的更多相关文章
- 水题 Codeforces Round #303 (Div. 2) D. Queue
题目传送门 /* 比C还水... */ #include <cstdio> #include <algorithm> #include <cstring> #inc ...
- 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 ...
- 水题 Codeforces Round #302 (Div. 2) A Set of Strings
题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...
- 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas
题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {" ...
- 水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas
题目传送门 /* 水题:ans = (1+2+3+...+n) * k - n,开long long */ #include <cstdio> #include <algorithm ...
- 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift
题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...
- 构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root
题目传送门 /* 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 */ #include <cstdio> #include <algori ...
- 水题 Codeforces Round #306 (Div. 2) A. Two Substrings
题目传送门 /* 水题:遍历一边先找AB,再BA,再遍历一边先找BA,再AB,两种情况满足一种就YES */ #include <cstdio> #include <iostream ...
- 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table
题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...
随机推荐
- 基于Ubuntu 14.04 LTS编译Android4.4.2源码
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/gobitan/article/details/24367439 基于Ubuntu 14.04 LTS ...
- C++11 std::function、std::bind和lambda表达式
参考博客: C++可调用对象详解-https://www.cnblogs.com/Philip-Tell-Truth/p/5814213.html 一.关于std::function与std::bin ...
- oracle:rman恢复----通过时间set until time
试验计划:先做一个0级备份,再创建一个表,插入几条数据,最后删除表,然后通过rman把该表的数据恢复. 试验环境:在归档模式,oracle10.2.0.1 开始试验: 1.rman level 0备份 ...
- Oracle:热备测试
我们知道Oracle数据库热备有3步: 1. alter tablespace tbname begin backup: 2. cp /××× to /×× 3. alter ta ...
- pyspark 日期格式
1. 获取当前日期 from pyspark.sql.functions import current_date spark.range(3).withColumn('date',current_da ...
- LA-4356&&hdu-2469 (极角排序+扫描线)
题目链接: Fire-Control System Time Limit: 12000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- php判断某个变量是否存在
sset— 检测变量是否设置,empty — 检查一个变量是否为空(是否存在也检测了,不存在或为空返回true)
- Ntrip通讯协议1.0
Ntrip通讯协议1.0 1 什么是Ntrip? CORS(Continuously Operating Reference Stations)就是网络基准站,通过网络收发GPS差分数据.用户访问CO ...
- MyBatis缓存设计
和大多数ORM框架一样,为了尽可能减少数据库的访问,MyBatis设计支持缓存功能.设计上通过Cache接口提供SPI(服务提供接口),可以让第三方缓存提供具体的缓存实现,比如使用ehcache.Re ...
- Android适合组件化开发的路由框架:Launch
1.概述 最近越来越不想写代码了,特别是一些重复性的代码,比如由于每次启动一个 Activity,我们都会很习惯的在 Activity 中写下: public static void launch(A ...