HDU 1008 电梯( 水题)】的更多相关文章

Delete Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5210 Description wld有n个数(a1,a2,...,an),他希望进行k次删除一个数的操作,使得最后剩下的n−k个数中有最多的不同的数,保证1≤n≤100,0≤k<n,1≤ai≤n(对于任意1≤i≤n) Input 多组数据(最多100组)对于每组数据:第一行:一个数n表示数的个数接下来一行:…
统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 36295    Accepted Submission(s): 13515 Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的…
题意: 电梯当前在0层,每在1层需要停5秒,往上走每层需6秒,往下走每层需要4秒. 思路: 在接收输入的时候直接计算了它,不用再弄一个循环.每计算一个请求就更新当前层,停留5秒的等到输出时再加上5*n就行了.这样老实计算就不需要考虑特殊情况了,比如第一个请求是在0层,是不是得停5秒先? #include <iostream> using namespace std; void main() { ,ans=,s=,i,a; while(scanf("%d",&n)&a…
已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这题输出二进制数就行了......那就更简单了,直接输出1,然后后面跟n-1个0就行了╮(╯_╰)╭ 下面AC代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm>…
题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最坑的地方就是结果精确到便士,也就是小数点后2位,不输出后缀0,所以需要处理一下输出格式. 一开始我是用c语言这样写的: #include <stdio.h> #include <string.h> int main() { int t; scanf("%d", &a…
GPA Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4802 Description In college, a student may take several courses. for each course i, he earns a certain credit (ci), and a mark ranging from A to F, which is c…
Tutor Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4493 Description Lilin was a student of Tonghua Normal University. She is studying at University of Chicago now. Besides studying, she worked as a tutor tea…
LCS Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5495 Description 你有两个序列\{a_1,a_2,...,a_n\}{a​1​​,a​2​​,...,a​n​​}和\{b_1,b_2,...,b_n\}{b​1​​,b​2​​,...,b​n​​}. 他们都是11到nn的一个排列. 你需要找到另一个排列\{p_1,p_2,...,p_n\}{p​1​…
http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn+1), si表示连续的空格数. 2.{}中间,即 | 的个数+1. 就是模拟 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <…
Acperience 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5734 Description Deep neural networks (DNN) have shown significant improvements in several application domains including computer vision and speech recognition. In computer vision, a particul…
http://acm.hdu.edu.cn/showproblem.php?pid=5003 记得排序后输出 #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> #include <set> #include <map> #include <algorithm> #include…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5211 题解: 1.筛法: #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<vector> using namespace std; +; const int INF=0x3f3f3f3f; int n; int a[maxn],mm…
Matrix 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5671 Description There is a matrix M that has n rows and m columns (1≤n≤1000,1≤m≤1000).Then we perform q(1≤q≤100,000) operations: 1 x y: Swap row x and row y (1≤x,y≤n); 2 x y: Swap column x and c…
Machine 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5670 Description There is a machine with m(2≤m≤30) coloured bulbs and a button.When the button is pushed, the rightmost bulb changes. For any changed bulb, if it is red now it will be green; if…
题目链接:HDU - 1015 === Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his factory, were destroyed in World…
http://acm.hdu.edu.cn/showproblem.php?pid=4696 由题意可知 1<=Ci<=2 而且图上一定有环 那么我们可以得出: 只要存在奇环(即Ci=1)..那么对于所有自然数Mi都能得到 否则就是偶环 只有Mi是偶数才能得到 /********************* Template ************************/ #include <set> #include <map> #include <list&…
题意:n个工人,有n件工作a,n件工作b,每个工人干一件a和一件b,a[i] ,b[i]代表工作时间,如果a[i]+b[j]>t,则老板要额外付钱a[i]+b[j]-t;现在要求老板付钱最少: 析:贪心策略,让大的和小的搭配,小的和大的搭配,是最优的. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #incl…
题目大意:题目描述了一大堆.....然而并没什么用,其实就是让求给的所有字符串里面有多少个"doge",不区分大小写.   代码如下: ====================================================================================================================== #include<stdio.h> #include<string.h> #include&…
Problem Description Jackson wants to know his rank in the class. The professor has posted a list of student numbers and marks. Compute Jackson's rank in class; that is, if he has the top mark(or is tied for the top mark) his rank is 1; if he has the…
密码 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 54994    Accepted Submission(s): 22267 Problem Description 网上流传一句话:"常在网上飘啊,哪能不挨刀啊-".其实要想能安安心心地上网其实也不难,学点安全知识就可以. 首先,我们就要设置一个安全的密码.那什么样的密码才…
题意:给你一个半圆,半圆以面积每年增加50平方英里的速度扩张.问(x, y)在多少年后被覆盖. 思路:emmm,其实最开始,还是打表的,因为每一年的半圆的半径可以算出来.啊啊啊啊,其实这个方法是可以的.但是!!!wa了! 为什么?因为  ∏ 只可以取3.1415926  所以一直wa. 然后,看了网上的题解!秒懂!其实面积是等差数列!然后把 ∏ 改了过来,秒ac #include<cstdio> #include<cmath> #define IP acos(-1) int mai…
排序 年轻的排前面 名字中可能有空格 Sample Input21FancyCoder 19962FancyCoder 1996xyz111 1997 Sample OutputFancyCoderxyz111FancyCoder # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <string> # includ…
你的一系列得分 先降序排列 再按0.95^(i-1)*ai 这个公式计算你的每一个得分 最后求和 Sample Input12530 478Sample Output984.1000000000 # include <iostream> # include <cstdio> # include <algorithm> # include <map> # include <cmath> # define LL long long using nam…
题意: 求最长回文串 长度要大于等于2  且输出起点和终点  输出回文串字符 这个字符还是要以给出的字符为起点a 输出 解析: 分析一下s_new串就好了 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include &l…
#include<stdio.h> #include<string.h> ]; int main() { ],s2[]; int l1,l2,i,j,k; while(scanf("%s %s",s1,s2)!=EOF) { l1=strlen(s1); l2=strlen(s2); ,l22=; while(s1[l11]=='A')l11++; while(s2[l22]=='A')l22++; ,j=l2-,k=;i>=l11&&j&…
题意: 析:不说话. #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include <queue> #include <string> #include <algorithm> #i…
循环移位的套路操作就是一份折开变两份 /*H E A D*/ void match(){ int n=strlen(T+1); int m=strlen(P+1); int j=0; rep(i,1,n){ if(flag)break; while(j>0&&(j==m||T[i]!=P[j+1])) j=nxt[j]; if(T[i]==P[j+1]) j++; f[i]=j; if(f[i]==m){ flag=1; break; } } } int main(){ while(…
题意:给 n 个数,输出众数,但是如果所有的频率都相同但数不同输出 Bad Mushroom. 析:直接记录个数直接暴力就,就是要注意只有一种频率的时候. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include…
Encoding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 36575    Accepted Submission(s): 16205 Problem Description Given a string containing only 'A' - 'Z', we could encode it using the follow…
Doubles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4266    Accepted Submission(s): 2945 Problem Description As part of an arithmetic competency program, your students will be given randoml…