===== 其它 =====
柠檬不酸只是萌
遇 见 最 美 的 自 己 。
展开
-
URAL 1823 — Ideal Gas
原题:http://acm.timus.ru/problem.aspx?space=1&num=1823题意:pV = nRT (克拉珀龙方程) R为已知量(= 8.314) 输入其中三个变量的值,求另一个变量。思路:因为题中限定V、T大于零,所以我们可以对p、n是否为零进行讨论。 undefined是答案不确定;error则为两种情况:1. 与V、T大于零矛盾;原创 2015-03-17 21:17:27 · 367 阅读 · 0 评论 -
HDU 1005 —— Number Sequence
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1005思路:找循环节;f[n] = (f[n-1]*A+f[n-2]*B)%7,所以f[n-1]和f[n-2]都只有7种可能:0、1、2、3、4、5、6,且A和B都是固定的,所以循环节最大就是7*7=49;#includeint res[100];int main(){ int a,原创 2016-09-12 15:28:09 · 263 阅读 · 0 评论 -
CodeForces 552D — Vanya and Triangles 暴力枚举
原题:http://codeforces.com/problemset/problem/552/D题意:给出n个点,问一共可以形成多少个三角形;思路:直接暴力枚举,判断三个点是否共线;当同个x的点有多个时,任意选择两个点都可以和其余的点构成三角形;#include#include#includeusing namespace std;int n;原创 2015-07-19 16:35:42 · 855 阅读 · 1 评论 -
HDU 1005 — Number Sequence
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1005思路:找规律;当出现两个1 时即找到了循环点;因为f[n]和f[n-1]、f[n-2]有关,所以当出现两个1时后面就全部一样了;#includeint a, b, n, i;int res[100000001];int main(){ while(scanf(原创 2015-07-03 13:57:13 · 359 阅读 · 0 评论 -
HDU 1014 — Uniform Generator
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1014题意:给出step, mod,然后根据公式产生随机数,初始数字都为0;若在0到mod-1的范围内,每个数都只出现一次,则输出good choice,否则输出bad choice;思路:将产生的随机数都放到一个数组里,对数组进行排序,然后判断是否有出现相同的数字;注意格式原创 2015-07-03 14:30:40 · 431 阅读 · 0 评论 -
HDU 1113 — Word Amalgamation
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1113题意:给出一部字典,然后输入一些字符串,从字典中查找是否有相对应地单词,若没有则输出NOT A VALID WORD;#include#include#include#include#includeusing namespace std;string str;map原创 2015-07-12 11:33:18 · 430 阅读 · 0 评论 -
HDU 1088 — Write a simple HTML Browser
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1088题意:1、遇到换行;2、遇到输出“--------------------------------------------------------------------------------”3、每行长度不得超过80,单词间有空格;#include#inc原创 2015-07-12 10:29:56 · 465 阅读 · 0 评论 -
HDU 1004 — Let the Balloon Rise
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1004题意:给定n个颜色,求个数最多的颜色;思路:col[i]保存不同的颜色;num[i]记录各种颜色的个数;每次输入一个颜色就和所有col数组进行比较,若col中有该种颜色,就将对应的num+1;若没有,则将该种颜色放到col数组中去;#includ原创 2015-07-03 11:37:25 · 404 阅读 · 0 评论 -
FZU 1894 — 志愿者选拔 单调队列
原题:http://acm.fzu.edu.cn/problem.php?pid=1894原创 2015-05-17 13:36:30 · 469 阅读 · 0 评论 -
HDU 1020 — Encoding
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1020题意:计算字符串中各字母的个数,1不必标记;#include#includechar s[10005];int main(){ int cas; scanf("%d", &cas); while(cas--) { scanf("%s", s); int len原创 2015-04-27 21:06:04 · 522 阅读 · 0 评论 -
HDU 1062 — Text Reverse
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1062 #include#includechar s[1100];char a[1100];int main(){ int cas; scanf("%d", &cas); getchar(); while(cas--) { gets(s); int len = strl原创 2015-04-27 22:20:00 · 322 阅读 · 0 评论 -
CodeForces 535B — Tavas and SaDDas
原题:http://codeforces.com/problemset/problem/535/B题意:求1 ~ n中只包含4、7的数有多少个;#include#include#include#includeusing namespace std;struct node{ long long x;};queueq;int main(){ int n; w原创 2015-04-27 20:24:17 · 552 阅读 · 0 评论 -
HDU 1039 — Easier Done Than Said?
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1039题意: 需满足以下三种情况: 1、至少存在一个元音字母; 2、不能连续三个都为元音或者都为辅音; 3、相邻两个字母不能相同,除了‘ee’和‘oo’;原创 2015-04-27 21:57:59 · 446 阅读 · 0 评论 -
ZOJ 3879 — Capture the Flag
原题:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3879题意:输入四个数n q s c ,n — 有n个队伍,q — 有q个服务器,s — 每个队伍的初始分数,c — 有c个操作; 对于每次操作,先输入一个数k,接下来k行,每行输入三个数a b c,表示a通过服务器c成功攻击了b;对于每次的成功攻原创 2015-04-26 19:27:38 · 559 阅读 · 0 评论 -
CSU 1562 — Fun House
原题:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1562题意:光线从‘*’ 发射,遇到 '/' 或 '\' 进行反射,最后射到墙上,将 'x' 变成'&' ;思路:因为 '/' 和 '\' 是45度倾斜的,所以光线反射的时候角度为90度; 所以枚举搜索一下就好啦 ^_^#includeint f[4][2原创 2015-04-18 20:15:52 · 414 阅读 · 0 评论 -
CSU 1565 — Word Cloud
原题:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1565题意:有N个单词,每个单词都有自己的宽度和高度(根据题给公式计算); 接下来N行,输入单词及每个单词的c值; 将这N个单词依次放到纸上,纸的宽度为W,且单词间隔10pt; 问单词的最终高度,即每行最高的那个单词的高度和; P为高度,cw就是输入原创 2015-04-18 19:55:41 · 442 阅读 · 0 评论 -
HDU 1058 —— Humble Numbers
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1058思路:每次保留最小的数,注意输出格式;#include#include#include#define Min(a, b, c, d) min(min(a, b), min(c, d))using namespace std;const int maxn = 6000;int原创 2016-10-17 21:50:38 · 278 阅读 · 0 评论