A. Toy Cars

U8备份提示“远程组件初始化失败” 问题现象: SQL出现问题后重装,U8没有重装,之后直接附加数据库,U8可以正常登陆,但是在备份的时候提示远程组件初始化失败。 问题原因: 因为重装了SQL,没有进行U8数据源初始化,导致Master库中丢失了存储过程储 解决办法:在Master库重建存储过程 USE [master] GO SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO CREATE PROCEDURE [dbo].[U8FileServerExtendProc] @cmdLi. 阅读详情
A. Toy Cars
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.

There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned over, both cars turned over. A car is good if it turned over in no collision. The results of the collisions are determined by an n × n matrix А: there is a number on the intersection of the і-th row and j-th column that describes the result of the collision of the і-th and the j-th car:

  •  - 1: if this pair of cars never collided.  - 1 occurs only on the main diagonal of the matrix.
  • 0: if no car turned over during the collision.
  • 1: if only the i-th car turned over during the collision.
  • 2: if only the j-th car turned over during the collision.
  • 3: if both cars turned over during the collision.

Susie wants to find all the good cars. She quickly determined which cars are good. Can you cope with the task?

Input

The first line contains integer n (1 ≤ n ≤ 100) — the number of cars.

Each of the next n lines contains n space-separated integers that determine matrix A.

It is guaranteed that on the main diagonal there are  - 1, and  - 1 doesn't appear anywhere else in the matrix.

It is guaranteed that the input is correct, that is, if Aij = 1, then Aji = 2, if Aij = 3, then Aji = 3, and if Aij = 0, then Aji = 0.

Output

Print the number of good cars and in the next line print their space-separated indices in the increasing order.

Sample test(s)
input
3
-1 0 0
0 -1 1
0 2 -1
output
2
1 3 
input
4
-1 3 3 3
3 -1 3 3
3 3 -1 3
3 3 3 -1
output
0

题意:n表示小车的数量,-1表示小车自己不会与自己相撞,1表示该行所表示的车号被撞坏,2表示该列所表示的车号被撞坏,3表示都被撞坏

法1:

#include<stdio.h>
#include<string.h>
int s[110][110], a[110], b[110], vis[110];

int main()
{
    int n, i, j;
    scanf("%d", &n);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            scanf("%d", &s[i][j]);
        }
    }
    memset(vis,0,sizeof(vis));
    memset(a,0,sizeof(a));
    for(int i=0;i<n;i++)
    {
        a[i]=i;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(s[i][j]==1)
            {
                vis[i]=1;
            }
            else if(s[i][j]==2)
            {
                vis[j]=1;
            }
            else if(s[i][j]==3)
            {
                vis[i]=vis[j]=1;
            }
        }
    }
    int t=0, sum=0;
    for(int i=0;i<n;i++)
    {
        if(vis[i]==0)
        {
            b[t++]=a[i];
            sum++;
        }
    }
    printf("%d\n", sum);
    if(sum!=0)
    {
        for(int i=0;i<t;i++)
        {
            printf("%d", b[i]+1);
            if(i<t-1)
                printf(" ");
        }
    }
    return 0;
}

法2

#include<stdio.h>
int main()
{
    int n;
    int s[110][110];
    scanf("%d", &n);
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            scanf("%d", &s[i][j]);
        }
    }
    int f;
    int a[110], t=0, sum=0;
    for(int i=0; i<n; i++)
    {
        f=1;
        for(int j=0; j<n; j++)
        {
            if(s[i][j]==1 || s[i][j]==3)
            {
                f=0;
                break;
            }
        }
        if(f==1)
        {

            a[t++]=i+1;

            sum++;
        }
    }
    printf("%d\n", sum);
    if(sum!=0)
    {
        for(int i=0; i<t; i++)
        {
            printf("%d", a[i]);
            if(i<t-1)
                printf(" ");
        }
    }
    return 0;
}

 

化工设备应力分析软件:STAAD.Pro二次开发_(24).非线性分析技术 在STAAD.Pro 中,可以通过命令。 阅读详情

相关推荐

CDH Hue连接Hbase报错TSocket read 0 bytes

问题描述 安装好CDH集群后,在Hue中查看HBase信息时,Hue界面报错如下: Api 错误:TSocket read 0 bytes Hue日志报错: exceptions_renderable ERROR Potential trace: [('/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/hue/apps/hbase/src/hbase/api.py', 46, 'query', 'return getattr(self

邢为栋 3493

Toy Cars

Description Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph. T...

无限迭代中...... 1021

GD32F103实战:用ADC+DMA实现高精度多通道电压采集与OLED实时显示(附完整工程)

本文详细介绍了如何利用GD32F103的ADC+DMA技术实现高精度多通道电压采集,并通过OLED实时显示数据。文章包含硬件架构设计、ADC配置技巧、DMA传输优化及显示系统实现方案,提供完整工程代码和调试指南,适用于工业传感器和环境监测设备开发。

weixin_42567497的博客 400

CodeForces - 545A Toy Cars (模拟)

【题目链接】:click here~~ 【题目大意】:题意】:给一个矩阵表示i行j列某辆车的状态,统计最后没有坏的车 代码: /* * Problem: CodeForces - 545A * Running time: 15MS * Complier: G++ * Author: herongwei * Create Time: 7:47 2015/9/17 星期四 *统

herongwei 的 BLOG 2171

Keil C51里用printf打印数据,为啥总出乱码?手把手教你%bd、%hd、%ld的正确用法

本文深入解析Keil C51中printf打印数据出现乱码的根本原因,并提供格式符%bd、%hd、%ld的正确用法指南。通过详细的调试技巧和实战案例,帮助开发者解决串口输出问题,提升单片机开发效率。

weixin_26854829的博客 281

可信数据空间:可信空间、区域功能节点、业务功能节点、连接器的关联关系

可信数据空间通过分层架构实现安全数据共享:可信空间作为顶层制定全局规则;区域功能节点协调辖区内功能节点协作;功能节点提供具体数据服务;连接器作为唯一通信通道确保安全交互。系统采用"规则自上而下约束,数据自下而上流动"机制,通过分层治理和标准化连接,在保证数据主权的同时实现跨域协作,具有策略分级执行、去中心化治理等特性,支持灵活扩展业务场景。

友莘居士的博客 1686

全球气候模式降尺度方法总结及其代码实现

简介总结各类型气候模式降尺度方法

WW、forever的博客 1万+

codeforces #303 div2 A. Toy Cars

A. Toy Cars time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie, thanks to her older brother, likes

somebody oneday 696

85-Halcon-- gen_cam_par_area_scan_division 函数功能(生成面阵相机镜头参数)

Halcon的gen_cam_par_area_scan_division算子用于生成面阵相机的镜头参数,支持除法畸变模型。该算子输出包含9个参数的元组,包括焦距(Focus)、畸变系数(Kappa)、像素尺寸(Sx,Sy)、主点坐标(Cx,Cy)和图像尺寸。文中详细解析了各参数含义、数学原理(包括畸变矫正公式和坐标转换),并提供了三个工业应用案例:高精度芯片尺寸测量、机器人焊接引导和大视野汽车表面检测。最后给出了完整的相机标定流程,涵盖参数生成、畸变校正和标定配置步骤,适用于工业视觉系统的精确标定需求。

weixin_45590420的博客 915

用 CL_HTTP_CLIENT 正确处理 Cookie,彻底解决 SAP Gateway OData 的 CSRF Token 校验失败

SAP OData 集成中 CSRF Token 校验失败的解决方案 问题现象:使用 Postman 测试 OData 写入成功,但 ABAP 代码调用时出现 CSRF token validation failed 错误。 根本原因:Postman 自动处理 Cookie,而 ABAP 代码仅获取了 CSRF Token 却遗漏了 Cookie 信息。SAP Gateway 要求修改请求必须同时携带 Token 和 Cookie 才能通过校验。 解决方案: 通过 GET 请求同时获取 CSRF Token

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 431

CodeForces 545A

Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph. There are n 

AC--我进步的足迹的博客 750

数控系统(CNC)系列:Fanuc 31i-B_(16).CNC系统的网络连接与数据传输

硬件连接:包括网络接口的类型、连接方式等。网络协议:常用的网络协议包括Ethernet、Modbus TCP、Profinet等。网络配置:如何在CNC系统中配置网络参数,使其能够正确接入网络。在网络化的现代工业生产环境中,CNC系统的网络连接和数据传输能力变得越来越重要。通过以太网、Modbus TCP和Profinet等网络协议,可以实现CNC系统与上位机、其他CNC系统以及各种工业设备之间的高效通信。

2401_87715305的博客 2435

CodeForces - 545A Toy Cars

Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph. There are n t...

qq_26139541的博客 324

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

A - Toy Cars

Time Limit:1000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64u Description Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up...

weixin_30333885的博客 98

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

codeforces 545A Toy Cars

点击打开链接 A. Toy Cars time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie, thanks to her older

zhang__liuchen的博客 268

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

CodeForces 303A Toy Cars

time limit per test 1 second memory limit per test256 megabytes inputstandard inputoutputstandard output Little Susie, thanks to her older brother, likes to play with cars. Today she decided

2cm的专栏 672

CodeForces - 545A Toy Cars 水题

题目链接:点击查看 Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph. T...

还我笑颜 263

Codeforces Round #303 A. Toy Cars

Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph. There are n

Code_KK的博客 390

挖掘机工作装置UG/NX三维建模与运动仿真毕业设计指南

机械设计中的三维建模与运动仿真是现代工程领域的核心技术,通过CAD/CAE软件实现复杂机构的可视化分析与优化。其原理基于参数化设计和多体动力学,能够精确模拟机械系统的运动轨迹、受力状态和干涉情况。在工程机械领域,这项技术对于挖掘机工作装置的设计具有重要价值,能够有效评估铰点布置合理性、液压缸推力需求和运动包络范围。基于UG/NX平台,设计师可以完成从动臂、斗杆建模到四连杆机构装配的全流程,通过虚拟装配约束和运动仿真分析,验证设计方案的可行性。毕业设计实践中,学生能够掌握铰点优化、干涉检查等关键技术,为重型机

weixin_33882452的博客 290

Codeforces Round #303 (Div.2)-A. Toy Cars(模拟)

A. Toy Cars time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie, thanks to her older brother, likes

梧桐下的四叶草 363

MVZ2鸭子版第12天:传动力板机制拆解与锁卡破解思路

在游戏关卡设计中,特殊地块机制往往比单纯堆叠数值更能决定挑战深度。以植物大战僵尸类Mod为例,当场地引入空间位移规则时,传统塔防的“阵型固化”思路便会失效。传动力板本质上是一个状态机,它依据单位进入触发格的时间、方向与目标格占用状态,执行强制位移操作。理解它的触发条件、作用优先级与连锁反应,是从“被动挨打”转向“主动控场”的关键。这类机制在关卡设计、策略推演与Mod测试领域都具有典型研究价值。本文以MVZ2鸭子版梦境世界拓展第12天为场景,拆解传动力板的判定流程,分析锁卡现象的根因,并给出可复现的验证方法与

weixin_34321753的博客 309

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

A. Toy Cars Time Limit: 20 SecMemory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/A Description Little Susie, thanks to her older brother, likes to play with cars. Today...

weixin_30237281的博客 107

contest: Codeforces Round #303 (Div. 2), problem: (A) Toy Cars

contest: Codeforces Round #303 (Div. 2), problem: (A) Toy Cars There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned over, both cars turned over. A car is good if it turned over

更好体验→ https://x-blankspace.github.io/ 824
上一篇: CodeForces 545A
下一篇: A. DZY Loves Chessboard
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值