
水题
文章平均质量分 80
huanghongxun
这个作者很懒,什么都没留下…
展开
-
2017 ACM ICPC East Central North America Regional Contest
手速场。。就不放队友的代码了。A: Abstract Art题目大意给定多个多边形,求面积并。题解模板题。B: Craters题目大意给定多个圆,求这些圆的凸包周长。题解一个圆最多引出两条切线,计算切线注意一些情况就好了。 不过我的做法是暴力将圆拆成3000个点,然后暴力求背包。#include <bits/stdc+...原创 2018-04-21 23:25:06 · 1036 阅读 · 0 评论 -
URAL 1011|Conductors|暴力
原文地址:http://acm.timus.ru/problem.aspx?space=1&num=1011背景每个做英译俄的工作的人都知道英语短语 “Naked conductor runs along the bus”有2种非常不同的意思。问题Ekaterinburg市的每辆公交车都有一个售票员。当你需要乘坐公交车的时候,你都需要给售票员钱。我们知道Ekaterinburg市有超过P%P\%的、原创 2017-10-03 21:12:14 · 323 阅读 · 0 评论 -
[Haskell] 一些简单题
二分查找,找出列表里是否存在给定的x 显然,列表必须是有序的(这就包括了元素是可比较的,也就是都属于Ord类型类)。binarySearch :: (Ord a) => a -> [a] -> BoolbinarySearch x list | x < mid = binarySearch x front | x > mid = binaryS原创 2017-10-03 00:01:21 · 1078 阅读 · 0 评论 -
URAL 1083|Factorials!!!|暴力
http://acm.timus.ru/problem.aspx?space=1&num=1083题目定义:如果k不整除n,有n!!⋯!=n(n−k)(n−2k)⋯(nmodk)n!!\cdots!=n(n-k)(n-2k)\cdots(n \mod k);如果k整除n,有n!!⋯!=n(n−k)(n−2k)⋯kn!!\cdots!=n(n-k)(n-2k)\cdots k(n后面跟着k个叹号)。原创 2017-10-06 20:24:40 · 313 阅读 · 0 评论 -
URAL 1089|Verification with a Vocabulary|暴力
http://acm.timus.ru/problem.aspx?space=1&num=1089题目你的英语老师跟你说她最近梦想有一个自动化的系统去批改小学生的作业,并统计有多少个单词拼错了。3月8号就要到了,你想写一个程序实现老师的想法,当做礼物送给老师,这样老师在考试打分的时候就可以照顾一下你。程序需要实现:替换错误的单词(正确的单词拼写列表已给出,单词拼写错误不超过一个字母),统计拼错的单词原创 2017-10-06 19:47:49 · 346 阅读 · 0 评论 -
CodeForces #?(727A|727B|727D|727F)|贪心|动态规划
727A题目大意:给出s和t,对s有2个操作:一个×2,一个*10+1,问怎么操作能使s变成t。 题解:暴力。。#include <cstdio>typedef long long ll;bool isPower2(ll x) { return x - (x & -x) == 0;}ll s, t, p[64];void output(int d, ll r) { puts原创 2016-10-16 12:02:29 · 1155 阅读 · 0 评论 -
CodeForces #379(734A|734B|734C|734D|734E|734F)|二分查找|模拟|树的半径|位运算
734A: Anton and Danik题目大意给定字符串中,D多输出Danik,A多输出Anton,一样多输出Friendship题解#include <cstdio>char s[100005];int main() { int n, i, d = 0, a = 0; scanf("%d%s", &n, s); for (i = 0; i < n; ++i)原创 2016-11-16 17:58:43 · 1931 阅读 · 0 评论 -
CodeForces 731
731A题目大意:类似电话表盘,不过表盘上有26个字母,问一开始表盘指向a,如何转动表盘使得依次指向字符串中的各个字符且转动表盘次数最小(转一格为一次) 题解:每次都拿最近的那个#include <cstdio>#include <algorithm>using namespace std;char s[128];int main() { int i, now, ans = 0,原创 2016-10-17 22:17:48 · 1286 阅读 · 0 评论 -
CodeForces 724|模拟|贪心|扩展欧几里得|
724A Checking the Calendar题目大意:题目感觉有点晦涩。。就是说给定不是闰年的某个月(1~11月)第一天是星期几,下个月的第一天是星期几,问你是否合法。#include int parseDay(char *ch) { if (ch[0] == 'm' ) return 0; if (ch[0] == 't' && c原创 2016-10-12 22:23:54 · 557 阅读 · 0 评论 -
CodeFoces #377(732A|732B|732C|732D|732E)|贪心
这是贪心大赛的节奏。。。732A Buy a Shovel题目大意一件商品k元,你身上有无数多个10元硬币和r(1≤r≤91\leq r\leq 9)元硬币,问买多少件商品你才可以刚好使用你身上的硬币购买而不需要找零。题解显然商品件数不会超过10件(10件时可以只使用10元硬币),且只k的个位数有关。#include <cstdio>int main() { int k, r, i;原创 2016-10-23 11:55:03 · 1220 阅读 · 0 评论 -
CodeForces 723
723A数轴上有3个点x1<x2<x3x_1<x_2<x_3,求一个点x0x_0,最小化|x1−x0|+|x2−x0|+|x3−x0||x_1-x_0|+|x_2-x_0|+|x_3-x_0|。 显然,x0x_0肯定在[x1,x3][x_1,x_3],否则不是最优解,故化简得:x3−x1+|x2−x0|x_3-x_1+|x_2-x_0|,故x0=x2x_0=x_2时解最小为x3−x1x_3-x_1原创 2016-10-04 22:24:43 · 1928 阅读 · 0 评论 -
UVa 119|Greedy Gift Givers|STL|map|水题
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=55题目大意在这个问题中,有一些要送礼物的好朋友,计算他们给出去的礼物的价值比收到的礼物的价值多多少(如果少的话结果为负数)。 (由于废话太多就翻译到这里了。。)输入输入包含多组数据,对于每组数据,第一行一个原创 2017-10-05 23:40:37 · 437 阅读 · 0 评论 -
UVa 120|Stacks of Flapjacks|暴力
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=56题目栈和队列通常被认为和数据结构的面包、黄油一样,在建筑、解析、操作系统和离散事件模拟等领域有应用。栈也对一些严谨的语言很重要。本问题涉及黄油和食物(这里用薄饼代替面包,因为翻动薄饼有一个独特而又完整系统的原创 2017-10-05 23:57:44 · 289 阅读 · 0 评论 -
UVa 118|Mutant Flatworld Explorers|
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=54题目翻译机器人学科、机器人动作设计、机器学习是横跨计算机科学许多分支的领域,比如人工智能、算法、电子与机械工程等等可以叫得上名的。此外,机器人(“robots”)还可以叫”turtles”(从Papert,原创 2017-10-06 09:39:15 · 459 阅读 · 0 评论 -
UVa 102|Ecological Bin Packing|暴力
原文地址:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=38题目翻译回收玻璃的时候需要将玻璃分成3个类别:棕色玻璃,绿色玻璃和无色玻璃。本问题中,给出3个回收箱,每个回收箱都装有一定数量的棕色、绿色和无色玻璃瓶。为了回收这些玻璃瓶,这些瓶子需要被重新分类到原创 2017-09-26 21:27:55 · 383 阅读 · 0 评论 -
UVa 105|The Skyline Problem|暴力|线段树
原文地址:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=41题目翻译随着高性能图形工作站的到来,CAD(计算机协助设计)和其他领域(CAM,VLSI design)的工作效率逐渐增加。一个关于绘图的问题是消除被遮挡的线条。你现在要写个程序帮助一个工程师绘制原创 2017-09-26 23:11:35 · 468 阅读 · 0 评论 -
UVa 100|The 3n+1 Problem|暴力|坑点多
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=36题目翻译计算机科学的问题经常被划分到已有的确切问题类别上(比如NP,无解,递归等)。本题需要你分析一个未知类别的算法的性质。考虑这样的一个算法:1 input n2 print n3 if n =原创 2017-09-25 23:30:17 · 916 阅读 · 0 评论 -
BZOJ 1024 SCOI2009 生日快乐 暴力搜索
奇怪以前做了却没写题解..强行爆搜保平安。#include #include using namespace std;double dfs(double x, double y, int t) { if (t == 1) return max(x / y, y / x); double mi = 1e18; for(int i = 1; i <= t /原创 2016-01-30 12:34:36 · 447 阅读 · 0 评论 -
UVALive 6181|HDU 4492|Mystery|猜题意|模拟
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4192输入// UVALive 6181, HDU 4492#include #include char str[4096];int main() { int T, x原创 2017-11-05 09:50:41 · 393 阅读 · 0 评论 -
UVALive 6173|HDU 4485|B-Casting|水体
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4184题目大意你的任务是计算大整数Dmod(B−1)D \mod (B-1),其中B是D的进制数。 比如: 782910 mod 9 = 8 377777777777777738 mod原创 2017-11-04 23:54:20 · 1883 阅读 · 0 评论 -
UVALive 6172|HDU 4484|Hailstone HOTPO|模拟
题目翻译Hailstone序列是: 1. 若n为偶数,除以2 2. 若n为奇数,乘3再加1 3. n=1时结束写一个程序计算序列元素的最大值。输入第一行一个整数P(1≤P≤100000)P(1\leq P\leq 100000),表示数据组数。 接下来对于每组数据一行2个整数,第一个整数是数据组编号,第二个整数为n(1≤n≤100000)n(1\leq n\leq 100000),为序列的第原创 2017-11-04 23:40:42 · 369 阅读 · 0 评论 -
UVALive 4886|HDU 3777|Page Count|暴力
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2887题目翻译当你希望执行word processor的打印命令时,你一般都会阐明你要打印那些页。比如你输入 10-15,25-28,8-4,13-20,9,8-8 表示一系列要打印的页码,原创 2017-10-22 11:29:33 · 428 阅读 · 0 评论 -
UVALive 5739|User Names|模拟
一个大学电脑系统通过下面的规则确定学生的用户名: 1. 用户名长度不超过MAXLENMAXLEN个字符。 2. 用户名第一个字符为这个人的first name,转换成小写,忽略非字母的字符 3. 把这个人的last name加到用户名后面(小写),如果超出MAXLENMAXLEN,只保留前MAXLENMAXLEN个字符。 4. 如果规则1~3产生的用户名在数据库中已经存在,若用户名长度为MA原创 2017-10-24 00:14:24 · 344 阅读 · 0 评论 -
UVALive 5733|Iterated Difference|暴力
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3744题目翻译给定非负整数数列{an}\{a_n\},用以下方法修改列表:新数列的第k个元素为|ak−ak+1|\left|a_k-a_{k+1}\right|,第n个元素为|an−a1|\le原创 2017-10-23 22:24:14 · 293 阅读 · 0 评论 -
Vijos 1034 家族 并查集
Vijos上编译成功VijosEx via JudgeDaemon2/13.7.4.0 via libjudge编译成功测试数据 #0: Accepted, time = 15 ms, mem = 452 KiB, score = 10测试数据 #1: Accepted, time = 0 ms, mem = 460 KiB, score = 10测试数据原创 2013-07-24 20:34:10 · 914 阅读 · 0 评论 -
NOIP 2012 Vijos 1787 普及组 寻宝 模拟
在Vijos上测试成功。测试数据 #0: Accepted, time = 0 ms, mem = 25284 KiB, score = 10测试数据 #1: Accepted, time = 0 ms, mem = 25284 KiB, score = 10测试数据 #2: Accepted, time = 0 ms, mem = 25280 KiB, score =原创 2013-07-22 13:05:39 · 1261 阅读 · 0 评论 -
POJ 1690 (Your)((Term)((Project))) 水题
POJ(1690)11878932huanghongxun1690Accepted744K0MSG++785B2013-07-29 16:07:35问题描述:小Y最近在学数学表达式,他很讨厌其中的括号(假设在小Y的表达式中只有小括号“(”、“)”),所以在小Y的表达式中是没有多余括号的(删去一对匹配的括号而使表达式值不变,原创 2013-07-29 16:36:00 · 1141 阅读 · 0 评论 -
BZOJ 3208 花神的秒题计划Ⅰ
暴力大法好。。#include #include #define FOR(i,j,k) for(int i=j;i<=k;i++)#define N 701const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};int n, a[N][N], b[N][N], f[N][N];void getmax(int &a, int b) {原创 2016-01-01 14:54:14 · 464 阅读 · 0 评论 -
BZOJ 4104 [Thu Summer Camp 2015]解密运算
恩。。夏令营。。#include #include using namespace std;const int N = 200001;#define FOR(i, j, k) for (i = j; i <= k; i ++)int a[N], b[N], c[N], d[N], ans[N];bool cmp(int x, int y) { if (原创 2015-12-31 21:44:15 · 711 阅读 · 0 评论 -
CodeForces 598D Igor In the Museum 暴力
题目大意:计算给定点所在区域中( . , * )对数。暴力就好啦。这是D题。。#include #include #define FOR(i,j,k) for(i=j;i<=k;i++)const int N = 1001;const int dx[] = {-1,0,1,0}, dy[] = {0,-1,0,1};char mp[N][N];int scc[N][N], sz原创 2015-11-28 15:50:58 · 754 阅读 · 0 评论 -
CodeForces 600C Make Palindrome 贪心
题意:给出字符串s,通过调整顺序或修改字符使字符串回文,输出修改次数最小且紫苜蓿最小的回文字符串。统计一下字母次数,字母序后的出现次数奇数的改成字母序小的,然后贪心选能使用的最小字符构建回文字符串即可。#include #include int main() { int i, j, k, len, s[26]={0}, w[26]={0}, wc = 0; static原创 2015-11-28 22:33:03 · 1102 阅读 · 0 评论 -
CodeForces 600D Area of Two Circles' Intersection 圆面积交 (POJ 2546, ZOJ 1597)
恩。。入门题。给出两圆坐标半径,求相交面积。切记开long double...中途忘改一个变量double WA test 36好几次。。发现sublime text在后缀名是cp的时候也能识别cpp,是我火星了么。对两圆心和交点组成三角形用下余弦定理就好了。cout怎么输出long double会跪的。。我gcc有问题么。#include #include #includ原创 2015-11-28 21:17:43 · 955 阅读 · 0 评论 -
CodeForces 260A Adding Digits 模拟
给出a和b,要求给a右端加一位数字n次且次次是b的倍数。按照题目模拟就行了,遇到结果就结束程序。发现throw+try catch退出dfs特别方便。#include int a, b, n;int num[100001];void dfs(int x, int d) { if (x > n) { printf("%d", a); for(int i=1;i<=n;i+原创 2015-11-17 20:00:27 · 634 阅读 · 0 评论 -
CodeForces 260B Ancient Prophesy 模拟
给出字符串找出符合"dd-mm-yyyy"格式的2013~2015年的出现次数最多的日期。一开始写成1~len-10怒跪。。。只要每位试一下就好了。#include #include #include char str[100005];int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};int cnt[4][16][32];原创 2015-11-17 21:24:07 · 625 阅读 · 0 评论 -
CodeForces 525A Vitaliy and Pie 题意题
好像按题意做就行了。。#include char s[200001];int a[100001],n,ans;int main() { scanf("%d%s",&n,s+1); for(int i=1;i<n;i++) { a[s[2*i-1]-'a']++; if(!a[s[2*i]-'A']) ans++; e原创 2015-11-15 17:44:41 · 620 阅读 · 0 评论 -
CodeForces 600E Lomsat gelral 暴力
给出一颗树,对于点v,color[v]表示v的颜色,dominating_color[v]表示v子树中color[v]出现次数最多的那个color[v],求sigma(其中x是v的后代){dominating_color[x]}。map暴力233。#include #include #include using std::map; using std::swap;const int原创 2015-12-06 22:01:35 · 1483 阅读 · 0 评论 -
CodeForces 586E Alice, Bob, Oranges and Apples 水题
起始水果池橙子和苹果各有x和y个,A和B各有1橙子和1苹果。操作A表示A将自己拥有橙子和苹果数的橙子和水果从水果池给B,操作B类似。问(x,y)在如何的操作序列后可以做到AB的水果数相等且水果池水果拿完了。操作序列任意。总觉得题意写的很难懂。。x、y与A、B之间顺序无关,下面只考虑x>y的情况。若y=1,那么操作A x/y=x次就结束了。否则操作A x/y次,A剩x%y原创 2015-12-06 22:52:50 · 571 阅读 · 0 评论 -
BZOJ 1603 [Usaco2008 Oct]打谷机 暴力搜索
一些齿轮之间有正着连接和反着连接,问最后一个齿轮的方向。dfs即可。写不写快速读入就是40ms和4ms的区别。。还真是资格赛。#include const int N = 1001, M = 2001;int read() { int s = 0, f = 1; char ch = getchar(); for (; ch '9'; ch = getchar(原创 2016-01-29 21:11:02 · 525 阅读 · 0 评论 -
NOIP 2008 Vijos 1497 立体图 模拟
在Vijos上编译成功测试数据 #0: Accepted, time = 0 ms, mem = 1340 KiB, score = 10测试数据 #1: Accepted, time = 0 ms, mem = 1336 KiB, score = 10测试数据 #2: Accepted, time = 0 ms, mem = 1336 KiB, score = 10原创 2013-07-22 20:56:32 · 1403 阅读 · 0 评论 -
机房水题欢乐赛 2016-02-18
明天就要去参加GDKOI了怎么办好虚QAQCodeForces 283 一日游:T1: Seghttp://blog.youkuaiyun.com/huanghongxun/article/details/50686941T2: Programhttp://blog.youkuaiyun.com/huanghongxun/article/details/50687100T3: Coinhttp://blog.csdn.ne原创 2016-02-18 16:55:19 · 396 阅读 · 0 评论