【codeforces 782A】Andryusha and Socks
来源:互联网 发布:js获取当前url参数 编辑:程序博客网 时间:2024/05/17 08:00
【题目链接】:http://codeforces.com/contest/782/problem/A
【题意】
如果手套没有成一双,那么其中的一只就会被放在桌子上;
问你桌子上手套的只数最多的时候有几只.
【题解】
按照题意模拟就好
【完整代码】
#include <bits/stdc++.h>using namespace std;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define LL long long#define rep1(i,a,b) for (int i = a;i <= b;i++)#define rep2(i,a,b) for (int i = a;i >= b;i--)#define mp make_pair#define pb push_back#define fi first#define se second#define rei(x) scanf("%d",&x)#define rel(x) scanf("%lld",&x)typedef pair<int, int> pii;typedef pair<LL, LL> pll;const int dx[9] = { 0,1,-1,0,0,-1,-1,1,1 };const int dy[9] = { 0,0,0,-1,1,-1,1,-1,1 };const double pi = acos(-1.0);const int N = 1e5+100;int n, ans = 1,now;bool bo[N];int main(){ //freopen("F:\\rush.txt", "r", stdin); rei(n); rep1(i, 1, 2 * n) { int x; rei(x); if (!bo[x]) { now++; ans = max(ans, now); bo[x] = true; } else { bo[x] = false; now--; } } printf("%d\n", ans); return 0;}
0 0
- 【codeforces 782A】Andryusha and Socks
- codeforces 782a Andryusha and Socks
- Codeforces 782 Andryusha and Socks
- Codeforces 780A-Andryusha and Socks
- CodeForces 780A Andryusha and Socks【水题】
- A. Andryusha and Socks
- cf 782A Andryusha and Socks
- cf 782A Andryusha and Socks
- Codeforces Round #403 (Div. 2) A. Andryusha and Socks(简单模拟)
- Andryusha and Socks
- 【codeforce】403 Div.2 A Andryusha and Socks
- CF-Round#403 Div2 A. Andryusha and Socks
- Codeforces A. Vasya and Socks
- 【codeforces 782C】Andryusha and Colored Balloons
- codeforces 782c Andryusha and Colored Balloons
- 【Codeforces Round #403】Codeforces 781A Andryusha and Colored Balloons
- codeforces-#460A Vasya and Socks
- Codeforces 460A Vasya and Socks(水题)
- 深入理解java虚拟机之volatile关键字
- Android Context 上下文 你必须知道的一切
- 九年开发生涯,而立之年带着一家老小离开了奋斗的广州
- Pillow学习之Tutorial
- 代码混淆后如何快速定位错误
- 【codeforces 782A】Andryusha and Socks
- 内存管理之memblock管理之移除块
- Spring Data JPA 实战(一)-体系结构及基本配置
- 在linux服务器上安装tomcat服务器步骤
- io流读写程序
- 浅谈数据库中的触发器
- C语言之判断100~200之间的素数(质数)
- clean code 读书笔记
- 保存图片到相册