ACM部分题库
Vas_Sago
这个作者很懒,什么都没留下…
展开
-
(HDU 1880)魔咒词典
Problem Description哈利波特在魔法学校的必修课之一就是学习魔咒。据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助。给你一部魔咒词典。当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能;当哈利需要某个功能但不知道该用什么魔咒时,你的程序要替他找到相应的魔咒。如果他要的魔咒不原创 2016-04-30 08:59:41 · 691 阅读 · 0 评论 -
(codeforces)C. Socks
どこでもドア:http://codeforces.com/problemset/problem/731/C并查集。。贪心。。code:const int MAX=2*1e5+5;int color[MAX],uni[MAX],sum[MAX],n,m,k,a,b;int get_boss(int x){ return x==uni[x] ? x : uni[x]=get_boss(uni[原创 2017-04-16 11:25:57 · 294 阅读 · 0 评论 -
(codeforces)B. Bear and Different Names
どれでもドア:http://codeforces.com/problemset/problem/771/B很有意思的一道题,题意也很简单 codechar c[6];int p=0,cnt=0;string getnewname(){ string name="A"; c[0]=c[1]=c[2]=c[3]=c[4]=c[5]='a'; c[p]=c[p]+cnt;原创 2017-04-15 14:18:55 · 262 阅读 · 0 评论 -
(HDU2063)过山车(匈牙利算法入门)
どこでもドア:http://acm.hdu.edu.cn/showproblem.php?pid=2063 关于二分图和匈牙利算法的相关知识:请点这里#include<bits/stdc++.h>using namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const double PI=acos(-1);cons原创 2017-04-30 12:59:17 · 295 阅读 · 0 评论 -
(codeforces)C. Alyona and Spreadsheet
どこでもドア:http://codeforces.com/problemset/problem/777/C开始以为是动态规划,不过要查找的时候就不知道怎么做了,普通搜 的话到第100组测试数据超时了。 方法:用二维数组d[i][j]存每一列到第i行递增开始的行数。如果让要查询l,r,只要满足r行最小的那个开始递增的行数<=l就是YES 比如对应题中的数据所得到的d[i][j]:1 1 1 1原创 2017-04-13 17:05:25 · 283 阅读 · 0 评论 -
(codeforces)D. Cloud of Hashtags
どれでもドア:http://codeforces.com/problemset/problem/777/D水题:删除其中一些字符串的一段连续的字符(必须是一直删除到结尾),使每个字符串按照字典序排序后,与输入时的位置相同。 方法:倒着两个两个比较,前面字符串的比后面的大的话就删除前者一段字符串, 删除时用二分查找删除字符数最少的位置。CODE:void change(string &str1,s原创 2017-04-12 20:24:27 · 245 阅读 · 0 评论 -
(code forces) C. Anton and Fairy Tale
どこでもドア:http://codeforces.com/problemset/problem/785/C 题意: 最开始谷仓一共友n个谷物。 每天的开始送来m个谷物,结束时i只鸟一共拿走i个谷物(i代表第i天)。 谷仓最多装下n个谷物。也就是说,第一天开始,谷仓是满的,所以带来的m个谷物后,谷仓还是n个谷物。 思路: 二分查找。可是直接查找会超数据范围(10e18) 开始有n个,从第原创 2017-04-09 11:17:27 · 312 阅读 · 0 评论 -
LUCKY STRING
题目描述 A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters , output all its lucky non-empty substrings原创 2016-12-29 15:28:54 · 382 阅读 · 0 评论 -
Parallelogram Counting(POJ1971)
http://poj.org/problem?id=1971DescriptionThere are n distinct points in the plane, given by their integer coordinates. Find the number of parallelograms whose vertices lie on these points. In原创 2016-04-30 09:02:30 · 597 阅读 · 0 评论 -
大明A+B
Description 话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。 这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法。 现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。 Input 本题目包含多组测试数据,请处理到文件结束。 每一组测试数据在一行里面包含两个长度不大于400的正小数A和B。Ou原创 2016-06-10 10:43:06 · 337 阅读 · 0 评论 -
扫描线
int main(){ map<int ,int >mp1,mp2; int n; cin>>n; for(int i=1;i<=n;i++) { int x,y; cin>>x>>y; mp1[x]++; mp2[y]++; } cout<<mp1[1]<<" "; f原创 2016-10-16 11:19:28 · 235 阅读 · 0 评论 -
(HDU 1063)Exponentiation(c++实现)
Description Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many compu原创 2016-05-04 13:51:43 · 1811 阅读 · 0 评论 -
(HDU 1002)A + B Problem II
Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.Input The first line of the input contains an integer T(1<=T<=20) which原创 2016-05-04 15:11:00 · 387 阅读 · 0 评论 -
ACM各种WA的说明及可能的原因
1、答案错误 —— wrong answer 就是最常见的。这个没办法,基本是程序有些细节的点没有考虑到。2、运行错误 —— Runtime Error 大致两种情况 1、是数组开太小,要存的数据太大,数组调大就OK了。 2、是数组发生越界操作,基本上是程序执行时访问到了不该访问的地方,程序问题了3、格式错误 —— presentation error 非常接近AC了。空格或者回车多输原创 2016-10-05 11:59:44 · 14263 阅读 · 0 评论