描述 http://train.usaco.org/usacoprob2?a=y0SKxY0Kc2q&S=gift1 给出不超过$10$个人,每个人拿出一定数量的钱平分给特定的人,求最后每个人的财产变化. Task 'gift1': Greedy Gift Givers A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends m…
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3049    Accepted Submission(s): 2364 Problem Description You are the CEO of Nasty Hacks Inc., a company that creates small pieces of…
Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Description A flow layout manager takes rectangular objects and places them in a rectangular window from left to right. If there isn't enough room in one r…
题目链接:http://poj.org/problem?id=2864 题意:参照题目 哈哈哈,这个题discuss有翻译哦.水到我不想交了. #include <cstdio> #include <cstdlib> #include <cstring> ][]; int main(void) { int r, c; int i, j; int flag; || r != ) { memset(arr, , sizeof(arr)); ; i < r; i++)…
题意:蚂蚁在木棍上爬,速度1cm/s,给出木棍长度和每只蚂蚁的位置,问蚂蚁全部下木棍的最长时间和最短时间. 模拟一下,发现其实灰常水的贪心... 不能直接求最大和最小的= =.只要求出每只蚂蚁都走长路下木棍时的最大值,和走短路时的就行了. 代码: /* * Author: illuz <iilluzen@gmail.com> * Blog: http://blog.csdn.net/hcbbt * File: uva10714.cpp * Lauguage: C/C++ * Create Da…
Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn trophies in different competitions. Each trophy is either golden or silver. The trophies are arranged in a row. The beauty of the arrangement is the le…
一场2012天津网络预选赛的题,签到题. 但是还是写了三四十分钟,C++和STL太不熟悉了,总是编译错误不知道怎么解决. 一开始用的Char [] 后来改成了string,STL和string搭配起来才好用啊. #include <algorithm> #include <iostream> #include <cstring> #include <ctype.h> #include <cstdlib> #include <cstdio&g…
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 <…
Mishka started participating in a programming contest. There are nn problems in the contest. Mishka's problem-solving skill is equal to kk. Mishka arranges all problems from the contest into a list. Because of his weird principles, Mishka only solves…
题目链接:http://poj.org/problem?id=2459 题目大意:有C头牛,下面有C行,每头牛放进草地的时间,每天吃一个草,总共有F1个草,想要在第D的时候,草地只剩下F2个草. 解题思路:模拟啊,就像砍树一样的问题,把每天失去的草计算出来,从最后一天往前推. #include <cstdio> #include <cstring> int C,F1,F2,D; ]; int main() { while (scanf("%d%d%d%d",&a…
题目:https://www.luogu.org/problemnew/show/P1079 大水题. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ,M=; int n,m; char a[N],b[N]; int get_int(char ch) { ; ; } int main() { scanf(); n=s…
题意: 模拟模拟~~ 代码: #include<iostream> using namespace std; const int maxn = 1005; int a[maxn], b[maxn], fa[maxn], fb[maxn]; int main (void) { int n;cin>>n; for(int i = 1; i <= n; i++){ cin>>a[i]; if(i==1) fa[i] = a[i]; else fa[i] = fa[i-1…
 1716: 毒 Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 96  Solved: 43 SubmitStatusWeb Board Description 现有n瓶毒药,第1瓶毒药的毒性为1,第i瓶毒药比第i-1瓶毒药的毒性增长了(((i-1)*K)%M),将第i瓶毒药的毒性记做vi. 你可以将任意两瓶毒药混合.若将第i瓶毒药和第j瓶毒药混合,则混合后的毒药的毒性为2*sqrt(vi*vj).(sqrt表示开方). 合并到最后,将会只剩…
Elevator Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 56481    Accepted Submission(s): 30942 Problem Description The highest building in our city has only one elevator. A request list is made…
Mike and Cellphone 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/E Description While swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old…
n个人 小明编号为m 从编号为a的人开始数 起始数字为b 遇到素数duang 并反相 求小明应该说什么 Sample Input 310 2 //n m3 4 //a b3 32 64 13 8 Sample Output duangduang10 # include <cstdio> # include <cstring> # define LL long long using namespace std ; ; bool notprime[MAXN];//值为false表示素数…
http://acm.hdu.edu.cn/showproblem.php?pid=5083 机器码和操作互相转化 注意SET还要判断末5位不为0输出Error #pragma comment(linker, "/STACK:36777216") #pragma GCC optimize ("O2") #include <cstdio> #include <cstdlib> #include <cmath> #include &l…
你的一系列得分 先降序排列 再按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…
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…
题目翻译: 1008.电梯 在我们的城市里,最高的建筑物里只有一部电梯.有一份由N个正数组成的请求列表.这些数表示电梯将会以规定的顺序在哪些楼层停下.电梯升高一层需要6秒,下降一层需要4秒.每次停下电梯将花费5秒. 给你一个请求列表,你需要计算出完成列表里的请求总共花费的时间.一开始电梯在0层.当请求全部完成时,电梯不需要回到底层. 输入说明: 每个输入文件包含一个测试实例.每个实例包含一个正整数N,后面跟着N个数字.所有输入的数字小于100. 输出说明: 对于每个测试实例,在一行中输出总时间.…
A string ss of length nn can be encrypted(加密) by the following algorithm: iterate(迭代) over all divisors(除数) of nn in decreasing order (i.e. from nn to 11), for each divisor dd, reverse the substring s[1…d]s[1…d] (i.e. the substring which starts at po…
You are given a string ss consisting of nn lowercase Latin letters. Polycarp wants to remove exactly kk characters (k≤nk≤n) from the string ss. Polycarp uses the following algorithm kk times: if there is at least one letter 'a', remove the leftmost o…
描述 http://train.usaco.org/usacoprob2?a=y0SKxY0Kc2q&S=ride 给出两个由大写字母组成,长度不大于$6$的字符串. 将字符串中的各字母的字典序数相乘,最后对$47$取模,比较两个字符串的结果是否相同. Your Ride Is Here It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal sup…
Problem Description The Chinese Zodiac, known as Sheng Xiao, is based on a twelve-year cycle, each year in the cycle related to an animal sign. These signs are the rat, ox, tiger, rabbit, dragon, snake, horse, sheep, monkey, rooster, dog and pig.Vict…
题目链接:http://codeforces.com/contest/404/problem/A #include <stdio.h> #include <string.h> #include <string.h> int n; ][]; ][]; int main() { scanf("%d",&n); memset(vis,false,sizeof(vis)); ;i<=n;i++) scanf(); char a,b; bool…
题目描述 一元nn次多项式可用如下的表达式表示: 其中,a_ix^iai​xi称为ii次项,a_iai​ 称为ii次项的系数.给出一个一元多项式各项的次数和系数,请按照如下规定的格式要求输出该多项式: 多项式中自变量为xx,从左到右按照次数递减顺序给出多项式. 多项式中只包含系数不为00的项. 如果多项式nn次项系数为正,则多项式开头不出现"++"号,如果多项式nn次项系 数为负,则多项式以"-−"号开头. 4. 对于不是最高次的项,以"++"号…
https://icpc.njust.edu.cn/Contest/749/A/ Description 小鱼喜欢吃糖果.他有两盒糖果,两盒糖果分别仅由小写字母组成的字符串s和字符串t构成.其中'a'到'z'表示具体的某种糖果类别. 他原本打算送给他喜欢的女生,但是要送给女孩子的话两盒糖果不能有差别(即字符串s和t完全相同).所以,他决定偷吃几块,他吃糖果的策略是每次选出一盒糖果中两个连续的同种类别的糖果,然后吃掉其中一块.该策略可以使用多次. 例如一盒糖果是'rrrjj',他可以把这盒糖果变成…
 悼念512汶川大地震遇难同胞--一定要记住我爱你 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9453    Accepted Submission(s): 5736 Problem Description 当抢救人员发现她的时候,她已经死了,是被垮塌下来的房子压死的,透过那一堆废墟的的间隙可以看到她死亡的姿势,双膝跪着,整个…
题目: 给出一串表示矩阵相乘的字符串,问这字符串中的矩阵相乘中所有元素相乘的次数. 思路: 遍历字符串遇到字母将其表示的矩阵压入栈中,遇到‘)’就将栈中的两个矩阵弹出来,然后计算这两个矩阵的元素相乘的次数,累加就可以了. PS:注意弹出的矩阵表示的先后顺序. 代码: #include <bits/stdc++.h> #define inf 0x3f3f3f3f #define MAX 1000000000 #define mod 1000000007 #define FRE() freopen…
Inna and Choose Options Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description There always is something to choose from! And now, instead of "Noughts and Cros…