Codeforces Round #187 (Div. 2) 只水果两题。。。
来源:互联网 发布:淘宝开店怎么刷销量 编辑:程序博客网 时间:2024/04/29 14:37
再一次证明我就是水水题的水果,今晚的cf就水了前两题,然后就束手无策了。。。
但是我还是厚脸皮的贴出前两题代码。。。
明天去找大神博客膜拜后面几题吧。。。
A
水!题目看了挺长时间,一开始还以为是并查集,想了15分钟后发现数据很小,暴力n^2能过。
但是我还是厚脸皮的贴出前两题代码。。。
明天去找大神博客膜拜后面几题吧。。。
A
水!题目看了挺长时间,一开始还以为是并查集,想了15分钟后发现数据很小,暴力n^2能过。
于是暴力水果了。
#include <cstdio>#define maxn 1010int main(){// freopen("in", "r", stdin); bool t[maxn] = {0}; int c[maxn][2]; int n, cnt = 0; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d%d", &c[i][0], &c[i][1]); for (int i = 0; i < n; i++) for (int j = 0; j <= n; j++) { if (i == j) continue; if (c[i][1] == c[j][0])//暴力标记能开的瓶子 t[j] = true; } for (int i = 0; i < n; i++) if (t[i]) cnt++; printf("%d\n", n - cnt); return 0;}
B
同水!
感觉很像C基础入门那种书里面的题目。。。
照着写了交上去在第11个测试点上面卡住了,目测是某位大神提交的测试点吧。。。
于是搞了个变化数而不是遍历去修改数组,水果了。。。
#include <cstdio>#define maxn 100010int main(){ // freopen("in", "r", stdin); int n, m; long a[maxn], change = 0;//change就是变化量 scanf("%d%d", &n, &m); int op; for (int i = 0; i < n; i++) scanf("%ld", &a[i]); while (m--) { scanf("%d", &op); if (op == 1) { int v, x; scanf("%d%d", &v, &x); a[v-1] = x - change; } else if (op == 2) { long tmp; scanf("%ld", &tmp); change += tmp; } else { int tmp; scanf("%d", &tmp); printf("%ld\n", a[tmp-1] + change); } } return 0;}
其他题亚历山大,我还修行不够。。。坐等大神题解。。。
- Codeforces Round #187 (Div. 2) 只水果两题。。。
- Codeforces Round #203 (Div. 2) 水果3题
- Codeforces Round #190 (Div. 2) 水果俩水题
- Codeforces Round #192 (Div. 2) 。。很水的只过了两题- -
- Codeforces Round #429 (Div. 2) D E两题总结
- Codeforces Round #187 (Div. 2)
- Codeforces Round #193 (Div. 2) C. Students' Revenge (两种优先级的贪心 好题)
- Codeforces Round #201 (Div. 2) 两道签到题(B, C)
- codeforces Round # 187(Div.2) D
- Codeforces Round #187 (Div. 2) 总结
- Codeforces Round #103 (Div. 2) E题
- Codeforces Round 134 div 2 C题
- Codeforces Round #153 (Div. 2) C题
- Codeforces Round #158 (Div. 2) C题
- Codeforces Round #181 (Div. 2) A题
- Codeforces Round #184 (Div. 2) A题
- Codeforces Round #172 (Div. 2) A题
- Codeforces Round #166 (Div. 2) A题
- struts2文件下载出现Can not find a java.io.InputStream with the name [imageStream] in the invocation stack.
- uestc oj 1670 积木
- java 对一单词的找出全部组合
- uestc oj 1230 Picture
- 表格布局(TableLayout)的简单使用
- Codeforces Round #187 (Div. 2) 只水果两题。。。
- POJ 1177 Picture (线段树+离散化+扫描线) 详解
- 黑马程序员--第十八天:IO流第一天
- 线段树(segment tree)
- 黑马程序员—java基础之反射与正则表达式
- MFC Edit控件 error:“DDX_Control”: 不能将参数 3 从“int”转换为“CWnd &”
- stagefright与opencore对比(转)
- uestc oj 1829 How Many Buildings
- Cocos2d-x游戏开发之单击事件_锁定触摸区域外的界面