390A. Inna and Alarm Clock
2014-02-12 12:31
253 查看
一道水题。。结果自己没注意范围。。。WA一次。。RE2次。。CE1次- - 这尼玛。。。然后就果断GG了
在闹钟响的时候 可以将一条直线上的闹钟全关。线可以是横的或竖的,但是只能用一种模式。
所以记录在同一行 和同一列的情况各有多少。
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int const M = 10010;
int main(){
int n;
scanf("%d",&n);
int hashx[M],hashy[M];
memset(hashy,0,sizeof(hashx));
memset(hashx,0,sizeof(hashy));
for(int i = 0;i < n;i++){
int x,y;
scanf("%d%d",&x,&y);
hashx[x] = 1;
hashy[y] = 1;
}
int xx = 0,yy = 0;
for(int i = 0;i < 101;i++){
if(hashx[i]) xx++;
if(hashy[i]) yy++;
}
printf("%d\n",xx>yy?yy:xx);
return 0;
};
在闹钟响的时候 可以将一条直线上的闹钟全关。线可以是横的或竖的,但是只能用一种模式。
所以记录在同一行 和同一列的情况各有多少。
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int const M = 10010;
int main(){
int n;
scanf("%d",&n);
int hashx[M],hashy[M];
memset(hashy,0,sizeof(hashx));
memset(hashx,0,sizeof(hashy));
for(int i = 0;i < n;i++){
int x,y;
scanf("%d%d",&x,&y);
hashx[x] = 1;
hashy[y] = 1;
}
int xx = 0,yy = 0;
for(int i = 0;i < 101;i++){
if(hashx[i]) xx++;
if(hashy[i]) yy++;
}
printf("%d\n",xx>yy?yy:xx);
return 0;
};
相关文章推荐
- codeforces 390A Inna and Alarm Clock
- Inna and Alarm Clock
- MorningSir AlarmClock HD(Description and Support)
- A. Inna and Alarm Clock
- MorningSir AlarmClock (Description and Support)
- CF 390A:Inna and Alarm Clock
- Codeforces 390A 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 Inna and Alarm Clock
- Codeforces Round #229 (Div. 2) Inna and Alarm Clock
- Codeforces Round #229 (Div. 2) A. Inna and Alarm Clock
- Get the Degree of Angle Between Hour and Minute Hand of a Clock at Anytime
- 8284 Clock generator and driver for 8086, 8088 processors
- clock and reset signal
- 闹钟AlarmAndMusic 和支持播放音乐效果《IT蓝豹》
- AnalogClock and DigitalClock
- CLOCK_MONOTONIC and CLOCK_REALTIME
- Get the Degree of Angle Between Hour and Minute Hand of a Clock at Anytime
- Method and apparatus for establishing IEEE 1588 clock synchronization across a network element comprising first and second cooperating smart interface converters wrapping the network element