水题 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> ...
随机推荐
- 【Java】Java代码经典错误清单
一.String 对照 == 和 equals.详细描写叙述例如以下 "=="操作符的作用 1)用于基本数据类型的比較,例如以下: byte(字节) 8 -128 - 127 0 ...
- EF(Entity Framework)通用DBHelper通用类,增删改查以及列表
其中 通用类名:DBhelper 实体类:UserInfo 1 //新增 2 DBHelper<UserInfo> dbhelper = new DBHelper<UserInfo& ...
- c3p0+spring
1. 首先是jdbc.properties属性文件的编写,便于数据库移植: datasource.driverClassName=oracle.jdbc.driver.OracleDriverdata ...
- 怎么整合小图标,组合到一张png里面
1.将切出来的图片,一个个打开,用动工具组合到新的图片中: 2.将新建的图片,背景选为透明,保存为png格式: 3.通过css的background-position属性设置元素的背景图片.
- Scrapy运行报错:ModuleNotFoundError: No module named 'douban.douban'
运行scrapy爬虫报错: from douban.douban.items import DoubanItem ModuleNotFoundError: No module named 'douba ...
- 启动tomcat时,经常遇到的问题 8080 端口被占用
启动tomcat失败时,弹出的窗口如上,说明8080被某个进程占用了 需要把占用8080端口的进程给kill掉 Win+R 输入运行cmd 打开命令提示符cmd.exe netstat -ano|fi ...
- Android自动化测试环境搭建
Android自动化环境的搭建主要包括: 1. java jdk和jre的安装和环境的配置 2. appium服务器的安装和配置 3. eclipse开发工具,这里不必要用Android Studio ...
- codeforces 690D2 D2. The Wall (medium)(组合数学)
题目链接: D2. The Wall (medium) time limit per test 2 seconds memory limit per test 256 megabytes input ...
- BZOJ_2253_[2010 Beijing wc]纸箱堆叠 _CDQ分治+树状数组
BZOJ_2253_[2010 Beijing wc]纸箱堆叠 _CDQ分治+树状数组 Description P 工厂是一个生产纸箱的工厂.纸箱生产线在人工输入三个参数 n p a , , 之后, ...
- JavaScript-Tool:wdtree
ylbtech-JavaScript-Tool:wdtree 1.返回顶部 1. 插件描述:wdTree是一个轻量级jQuery插件用于创建一个带有嵌套Check Boxe的树形控件. wdTree是 ...