博客
关于我
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/

你可能感兴趣的文章
nginx: [emerg] getpwnam(“www”) failed 错误处理方法
查看>>
nginx:Error ./configure: error: the HTTP rewrite module requires the PCRE library
查看>>
Nginx、HAProxy、LVS
查看>>
Nginx下配置codeigniter框架方法
查看>>
Nginx中使用expires指令实现配置浏览器缓存
查看>>
Nginx之二:nginx.conf简单配置(参数详解)
查看>>
Nginx代理websocket配置(解决websocket异常断开连接tcp连接不断问题)
查看>>
Nginx代理初探
查看>>
nginx代理地图服务--离线部署地图服务(地图数据篇.4)
查看>>
Nginx代理外网映射
查看>>
Nginx代理模式下 log-format 获取客户端真实IP
查看>>
Nginx代理解决跨域问题(导致图片只能预览不能下载)
查看>>
Nginx代理配置详解
查看>>
Nginx代理静态资源(gis瓦片图片)实现非固定ip的url适配网络环境映射ip下的资源请求解决方案
查看>>
Nginx代理静态资源(gis瓦片图片)实现非固定ip的url适配网络环境映射ip下的资源请求解决方案
查看>>
nginx反向代理
查看>>
nginx反向代理、文件批量改名及统计ip访问量等精髓总结
查看>>
Nginx反向代理与正向代理配置
查看>>
Nginx反向代理及负载均衡实现过程部署
查看>>
Nginx反向代理是什么意思?如何配置Nginx反向代理?
查看>>