LaunchPad
链接:https://ac.nowcoder.com/acm/contest/3665/D
来源:牛客网
The LaunchPad is a touch screen divided into squares of N rows and M columns. Each square has two states of light and shade. And all squares are shady initially. When you touch the square in row X and column Y, the state of all the squares in the row and column will change. Now he wants to know how many squares are light on the LaunchPad after he makes multiple touches.
输入描述:
The first line of input contains two integers N,M(1≤N,M≤1000)N,M (1\leq N,M\leq 1000)N,M(1≤N,M≤1000) denoting the rows and columns of LaunchPad.
The second line of input contains single integer Q(0≤Q≤106)Q (0\leq Q\leq 10^6)Q(0≤Q≤106) denoting the times of touch.
On the next Q lines,describe X and Y - the position of the square being touched. (1≤X≤N,1≤Y≤M)(1\leq X \leq N,1\leq Y\leq M)(1≤X≤N,1≤Y≤M)
输出描述:
Print one line - the number of the squares that is on light state.
说明
题目大意:
就是说一开始n*m矩阵中都是暗的,你可以按压n*m矩阵中任意一个方格,该方格行和列都会变亮,再摁一次会变暗,问m次操作后亮的方格的个数;
解析:
就是行和列的性质不变,但是vis[a][b]会重复
AC代码:
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
inline int read() {int x=,f=;char c=getchar();while(c!='-'&&(c<''||c>''))c=getchar();if(c=='-')f=-,c=getchar();while(c>=''&&c<='')x=x*+c-'',c=getchar();return f*x;}
typedef long long ll;
const int maxn=1e4+;
const int M=1e7+;
const int INF=0x3f3f3f3f;
int vis[][];
int h[maxn];//行
int l[maxn];//列
int main()
{
int n,m,t;
cin>>n>>m>>t;
int a,b;
for(int i=;i<t;i++){
cin>>a>>b;
h[a]++;
l[b]++;
vis[a][b]++;
}
int sum=;
for(int i=;i<=n;i++){
for(int j=;j<=m;j++){
if((h[i]+l[j]-vis[i][j])%==){
sum++;
}
}
}
printf("%d",sum);
return ;
}
LaunchPad的更多相关文章
- Launchpad添加openPGP keys
转自: https://help.ubuntu.com/community/GnuPrivacyGuardHowto mac下: http://notes.jerzygangi.com/the-bes ...
- 应用删除后 Launchpad 上仍有应用图标无法删除的解决方法
应用删除后 Launchpad 上仍有应用图标上带有问号且无法删除时,可以将 launchpad 重置. 在终端输入: defaults write com.apple.dock ResetLaunc ...
- window bzr launchpad 安装配置
1: https://launchpad.net/bzr/2.6/2.6b1/+download/bzr-2.6b1-1-setup.exe 使用Standalone版本 , 安装时选择plugin ...
- CCS v5 无法启动解决办法及Launchpad仿真器电脑无法识别解决方法
安装ccs_setup_5.1.1.00028.exe后(无论是自己装eclipse还是在原来的基础上安装eclipse的插件),ccs5的应用无法打开,错误为:An error has occurr ...
- osx launchpad删除图标
安装了个parallels desktop之后,OSX中的launchpad中的图标多了不少,但是好多都不是我自己想要的,我们该怎么删除或者改动呢,以下介绍一些方法: ①直接操作Appications ...
- Launchpad灰色图标怎么删除?重置Launchpad教程
打开终端,第一步输入:defaults write com.apple.dock ResetLaunchPad -bool true 按下return键 第二步输入:killall Dock 按下re ...
- MAC 调整Launchpad 图标大小
1.调整每一列显示图标数量 defaults write com.apple.dock springboard-rows -int 7 2.调整每一行显示图标数量 defaults write com ...
- Ubuntu 16.04系统下出现E: 无法下载 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
在安装完成Chrome浏览器后,终端执行以下更新命令 sudo apt-get update 时出现E: 无法下载 http://ppa.launchpad.net/fcitx-team/nightl ...
- 解决 Mac launchpad 启动台 Gitter 图标无法删除的问题
Mac 删除应用非常简单,将应用拖到回收站就删除了.或者进入应用程序文件夹,选中程序,command + delete 就删除了应用,这也是删除文件的快捷键. 但是,安装 Gitter 后,删除了应用 ...
- 解决Mac应用程序软件不出现在Launchpad里面的方法
新装了几个软件,可是打开Lauchpad之后却在里面找不到,真是烦人!然后尝试了以下方法: 1.重启电脑,没用: 2.尝试打开“应用程序(英文名称:Applications)”并找到安装的软件,然后直 ...
随机推荐
- SpringCloud大白话之服务注册中心
SpringCloud-Eureka白话说明 eureka.client.register-with-eureka 属性表示是否将自己注册到Eureka Server, 默认为true. 由于当前应用 ...
- 操作系統3-內存管理(Linux內存管理)
操作系統3-內存管理(Linux系統的內存管理方法) 9.Linux系統的內存管理方法 Linux採用"按需調頁"算法,支持三層管理策略.由於Intel CPU在硬件級提供了段式存 ...
- win10下安装es
1.安装前提 windows下已经安装好了jdk8的版本 2.下载ElasticSearch https://www.elastic.co/cn/downloads/elasticsearch#ga- ...
- jquery如何将信息遍历到界面上
1.使用的时候一定要导入juqery库 1.1 这里放置一个cdn的库 <script src="https://cdn.staticfile.org/jquery/1.10.2/jq ...
- 什么是nuget?nuget包是如何管理
本文链接:https://blog.csdn.net/Microsoft_Mao/article/details/101159800做windows开发的,迟早会接触到nuget这个东西,那么今天我们 ...
- pikaqiu练习平台(CSRF(跨站请求伪造) )
CSRF(跨站请求伪造) CSRF(跨站请求伪造)概述 Cross-site request forgery 简称为“CSRF”,在CSRF的攻击场景中攻击者会伪造一个请求(这个请求一般是一个链接 ...
- 【C语言】多维数组
C 语言支持多维数组.多维数组声明的一般形式如下: type name[size1][size2]...[sizeN]; 二维数组 多维数组最简单的形式是二维数组.一个二维数组,在本质上,是一个一维数 ...
- 【做题笔记】CF1311A、B、C
或许以后会有D. A 题目大意:给定两个整数 \(a,b\) ,每次可以进行一下任意一个操作: \(a\) 加上任意一个正奇数 \(b\) 减去任意一个正偶数 问是否可以通过若干次操作把 \(a\) ...
- Linux上查看当前系统各内存分区信息
命令 ulimit -a -a 查看所有信息,同理,也可以例如 ulimit -s 只查看栈占内存信息
- python开发基础01-字符串操作方法汇总
字符串 Python对字符串的处理内置了很多高效的函数,非常方便功能很强大. "hello world" 字符串七种常用功能: 连接和合并 + join 移除空白 strip 分 ...