博客
关于我
UPC 2020年秋季组队训练赛第十一场
阅读量:535 次
发布时间:2019-03-08

本文共 6238 字,大约阅读时间需要 20 分钟。

问题 A: Divide the Cash

时间限制: 1 Sec 内存限制: 128 MB

题目描述

The UCF Programming Team coaches schedule practices regularly in fall and spring (by the way, all UCF students are welcome to the practices). During summer, the majority of the team members are gone but the coaches know how to make sure the students don’t get “rusty”. The
coaches usually give prize money and reward the team members based on how many problems they solve during summer. For example, let’s assume the coaches have $1,000 in prize money and there are three students. Let’s also assume the three students solve, respectively, 5, 8 and 7 problems, i.e., a total of 20 problems. So, the reward for one problem will be $50 ($1000/20) and the three team members will receive, respectively, $250, $400 and $350.

Given the total prize money and the number of problems each team member has solved, compute the reward for each student.

输入

The first input line contains two integers: n (1 ≤ n ≤ 30), indicating the number of team members and d (1 ≤ d ≤ 30,000), indicating the dollar amount to be divided among the students. Each of the next n input lines contains an integer (between 1 and 300, inclusive) indicating the number of
problems a team member has solved. Assume that the input values are such that the reward for one problem will be an integer number of dollars.
输出
Print the pay, in dollars, for each team member (in the same order as they appear in the input).

样例输入

3 1000
5
8
7
样例输出
250
400
350

解法:直接模拟…

问题 B: Sort by Frequency

时间限制: 1 Sec 内存限制: 128 MB

题目描述

We all have heard the expression “more is better” so, in this problem, we are going to give higher precedence to the letter occurring the most.

Given a string containing only lowercase letters, you are to sort the letters in the string such that the letter occurring the most appears first, then the letter occurring the second most, etc. If two or more letters occur the same number of times, they should appear in alphabetical order in the output.

输入

The input consists of a single string, appearing on a line by itself, starting in column 1 and not exceeding column 70. The input will contain only lowercase letters (at least one letter).
输出
Print the sorted version of the input string, all on one line with no spaces.

样例输入

dcbbdabb
样例输出
bbbbddac

题意一个长度不超过70的字符串,依次输出出现次数最多的字符,出现次数相同时,按照字典序输出。

做法1

#include 
#include
using namespace std;typedef pair
PIC;string s;map
heap;struct A { int a; char b; bool operator< (const A &w) const { if(a!=w.a) return a>w.a; return b
> s; for(int i=0; i

做法2

#include 
using namespace std;const int N=30;string ch;int vis[N];struct node { int a,d; bool operator<(const node &t) { return d!=t.d?d>t.d:a
>ch; int k=0; for(int i=0; i

问题 C: Fitting on the Bed

时间限制: 1 Sec 内存限制: 128 MB

题目描述

Arup’s daughter, Anya, doesn’t like sleeping in a bed in the usual way. In particular, she is willing to put her head anywhere, and furthermore, she’s willing to lie in any direction. For the purposes of this problem, Anya, who is quite skinny, as she’s only at the fifth percentile in weight, will be modeled as a line segment with her head being one of the end points of the segment. The bed will be modeled as a rectangle with the bottom left corner with coordinates (0, 0), the top left corner with coordinates (0, L), where L is the length of the bed, and the top right corner with coordinates
(W, L), where W is the width of the bed. In the left diagram below, Anya’s head is near the top left corner and she’s sleeping completely sideways, off the bed - this corresponds to the first sample case. In the right diagram below, her head starts at a point a bit below where it starts in the first
diagram, but she’s sleeping at a diagonal, which allows her to fit on the bed!
在这里插入图片描述
Given the size of the bed, the location of Anya’s head, her height, and the angle in which her body is in relation to her head (here we use 0 degrees to indicate that her body is going straight to the right of her head and 90 degrees to indicate that her body is going above her head), determine if Anya is fully fitting within the bed or not. (Note: a normal sleeping position would be having your head near (W/2, L) with your body in the direction of 270 degrees.)

输入

The first line of input contains three positive integers: L (L ≤ 500), the length of the bed in centimeters, W (W ≤ 500), the width of the bed in centimeters, and H (H ≤ 200), Anya’s height in centimeters. The second line of input contains three non-negative integers: x (x ≤ W), the number of centimeters from the left side of the bed Anya’s head is, y (y ≤ L), the number of centimeters from the bottom of the bed Anya’s head is, and a (a ≤ 359), the angle in degrees Anya’s body is facing in relation to her head.
输出
On a line by itself, output “YES” (no quotes) if Anya completely fits on the bed, or “NO”, otherwise. Note: for all cases where Anya doesn’t fit on the bed, at least 1% of her body will be off the bed. She’s considered on the bed if part or all of her touches edges of the bed but none of her body extends off the bed.

样例输入

200 150 115
40 190 0
样例输出
NO

提示

In the sample case, Anya’s head is near the top of the bed 40 centimeters from the left end of the bed, but her body is veering completely to the right. Since there is only 110 cm to the right and Anya is 115 cm tall, 5 cm of her is off the bed.

最后一个样例卡常,用随机化过了。

#include 
using namespace std ;#define ios ios::sync_with_stdio(false) ,cin.tie(0)typedef long long ll ;const double esp = 1e-3 , pi = acos(-1) ;typedef pair
PII ;int work(){ double L , W , H , x , y , a ; cin >> L >> W >> H ; cin >> x >> y >> a ; double p = 1.0 * a * pi / 180.0 ; double xx = x + H * cos(p) ; double yy = y + H * sin(p) ; if(xx > -esp && yy > -esp && xx < W + esp && yy < L + esp) return 0 * puts("YES") ; double xxx = x + 0.99 * H * cos(p) ; double yyy = y + 0.99 * H * sin(p) ; if(xxx > W + esp || yyy > L + esp || xxx < - esp || yyy < - esp) return 0 * puts("NO") ; srand(time(0)) ; if(rand() % 2) puts("YES"); return 0 * puts("NO");}int main(){ work() ; return 0 ;}

转载地址:http://ncfiz.baihongyu.com/

你可能感兴趣的文章
mysql也能注册到eureka_SpringCloud如何向Eureka中进行注册微服务-百度经验
查看>>
mysql乱码
查看>>
Mysql事务。开启事务、脏读、不可重复读、幻读、隔离级别
查看>>
MySQL事务与锁详解
查看>>
MySQL事务原理以及MVCC详解
查看>>
MySQL事务及其特性与锁机制
查看>>
mysql事务理解
查看>>
MySQL事务详解结合MVCC机制的理解
查看>>
MySQL事务隔离级别:读未提交、读已提交、可重复读和串行
查看>>
MySQL事务隔离级别:读未提交、读已提交、可重复读和串行
查看>>
webpack css文件处理
查看>>
mysql二进制包安装和遇到的问题
查看>>
MySql二进制日志的应用及恢復
查看>>
mysql互换表中两列数据方法
查看>>
mysql五补充部分:SQL逻辑查询语句执行顺序
查看>>
mysql交互式连接&非交互式连接
查看>>
MySQL什么情况下会导致索引失效
查看>>
Mysql什么时候建索引
查看>>
MySql从入门到精通
查看>>
MYSQL从入门到精通(一)
查看>>