Codeforces 390A Inna and Alarm Clock(水题)
来源:互联网 发布:淘宝电子产品 编辑:程序博客网 时间:2024/05/01 02:59
题目链接:Codeforces 390A Inna and Alarm Clock
题目大意:给出一些点,表示该点上有灯,每次可以关掉一排或者一竖的灯,问说最少需要关几次。
解题思路:水题,计算出横线的个数和竖线的个数,去最小值。
#include <stdio.h>#include <string.h>#include <iostream>using namespace std;const int N = 105;int n, cx[N], cy[N];int main () {int nx = 0, ny = 0, xi, yi;memset(cx, 0, sizeof(cx));memset(cy, 0, sizeof(cy));scanf("%d", &n);for (int i = 0; i < n; i++) {scanf("%d%d", &xi, &yi);if (cx[xi] == 0) nx++;if (cy[yi] == 0) ny++;cx[xi]++; cy[yi]++;}printf("%d\n", min(nx, ny));return 0;}
0 0
- Codeforces 390A Inna and Alarm Clock(水题)
- codeforces 390A Inna and Alarm Clock
- 390A. Inna and Alarm Clock
- CF 390A:Inna and Alarm Clock
- codeforces Inna and Alarm Clock
- A. Inna and Alarm Clock
- Codeforces Round #229 (Div. 2)A. Inna and Alarm Clock
- Codeforces Round #229 (Div. 2) A. Inna and Alarm Clock
- Codeforces Round #229 (Div. 2) A. Inna and Alarm Clock
- Inna and Alarm Clock
- Codeforces Round #229 (Div. 2) Inna and Alarm Clock
- Codeforces 400A Inna and Choose Options 【水题】
- Codeforces 400A Inna and Choose Options(暴力)
- CodeForces 400A(Inna and Choose Options)
- CodeForces 374 A. Inna and Pink Pony
- CodeForces 374A Inna and Pink Pony
- codeforces 400A - Inna and Choose Options
- Codeforces 400A Inna and Choose Options
- Pat(Advanced Level)Practice--1014(Waiting in Line)
- 【matlab】libtest2.dll : fatal error LNK1136: invalid or corrupt file
- AndroidManifest.xml:10: error: Error: No resource found that matches the given name (at 'icon' with
- 优化SQL查询:如何写出高性能SQL语句
- python编辑器对比和推荐
- Codeforces 390A Inna and Alarm Clock(水题)
- Cocos2d-x提供的57种字体
- 创建一个最简单的Linux随机启动服务
- SIEBEL助手
- OpenCV 学习笔记(1)安装设置、显示图像
- 程序员童鞋们,眼睛疲劳了有没有,缓解下有没有,一起来做吧
- java.lang.UnsatisfiedLinkError 本机使用gwt json解析String出现问题
- open source project for recommendation system
- Tablayout属性以及设置行间距和列间距