04.06 UCF Local Programming Contest 2017
A.Electric Bill
题意:简单计算题,超过1000部分额外算
1 #include<stdio.h>
2 int main(){
3 int money1,money2;
4 long long int sum=0,n,num;
5 scanf("%d %d",&money1,&money2);
6 scanf("%lld",&n);
7 while(n--){
8 sum=0;
9 scanf("%lld",&num);
10 if(num>1000){
11 sum+=(num-1000)*money2;
12 sum+=1000*money1;
13 printf("%lld %lld\n",num,sum);
14 }else{
15 printf("%lld %lld\n",num,num*money1);
16 }
17 }
18 }
B.Simplified Keyboard
题目:判断是题目中说的哪一类
1 #include<bits/stdc++.h>
2 using namespace std;
3 int pos[9] = {-10,-9,-8,-1,0,1,8,9,10};
4 char a[27] = "abcdefghijklmnopqrstuvwxyz";
5 int main()
6 {
7 int n;
8 scanf("%d",&n);
9 while(n--)
10 {
11 int i,j,k;
12 int flag = 3;
13 char s1[21],s2[21];
14 scanf("%s %s",s1,s2);
15 if(strcmp(s1,s2)==0)
16 flag=1;
17 else
18 {
19 if(strlen(s1)!=strlen(s2))
20 flag = 3;
21 else
22 {
23
24 flag = 2;
25 for(i = 0; i < strlen(s1); i++)
26 {
27 int isok = 0;
28 for(j = 0; j < 9; j++)
29 {
30 if(s2[i]-'a'+pos[j]>=0&&s2[i]-'a'+pos[j]<=25)
31 {
32 if(s1[i]==a[s2[i]-'a'+pos[j]])
33 {
34 isok = 1;
35 break;
36 }
37
38
39 }
40
41 }if(isok == 1)
42 continue;
43 else {flag = 3;break;}
44
45 }
46
47 }
48 }
49 printf("%d\n",flag);
50 }
51
52
53
54 }
C.Singin' in the Rain
题目:和上场比赛的CDs题有点相同,只是贪心找最小即可,把样例一列出来,找找规律即可
1 #include<cstdio>
2 #include<cmath>
3 #include<algorithm>
4 #include<iostream>
5 using namespace std;
6 int main(){
7 int m,n,t,s;
8 long long int sum=0;
9 int a[1010];
10 scanf("%d",&n);
11 while(n--){
12 sum=0;
13 scanf("%d %d",&t,&s);
14 for(int i=0;i<s;i++){
15 scanf("%d",&a[i]);
16 }
17 for(int i=0;i<s-1;i++){
18 if(a[i]>a[i+1]){
19 sum+=min((a[i]-a[i+1]+1),(a[i+1]+t-1-a[i]));
20 }else if(a[i]==a[i+1]){
21 sum++;
22 }else if(a[i]+1==a[i+1]){
23 continue;
24 }else{
25 sum+=min((a[i+1]-a[i]-1),(a[i]+t-a[i+1]+1));
26 }
27 }
28 printf("%lld\n",sum);
29 }
30 }
E.Simple Darts
题目:进行区域判断,通过反三角函数和圆位置进行相对判断,从而确定分数
1 #include<iostream>
2 #include<algorithm>
3 #include<cstdio>
4 #include<cmath>
5 #include<string>
6 #include<map>
7 #include<sstream>
8 #include<cstring>
9 #include<vector>
10 #include<queue>
11 #define LL long long
12 const double pi=3.1415926;
13 using namespace std;
14 int main(){
15 int n;
16 scanf("%d",&n);
17 while(n--){
18 int w,b,d,s;
19 cin >> w >> b >> d >> s;
20 int t;
21 cin >> t;
22 long long int ans = 0;
23 while(t--){
24 double x,y;
25 cin >> x >> y;
26 double r,jiao;
27 r = x*x + y*y;
28 double fen = 2*pi/w;
29 if(r < b*b){
30 ans+=50;
31 }else if(r > b*b && r < d*d){
32 if((y/x)>0&&y>0){
33 jiao=atan(y/x);
34 }else if((y/x)>0&&y<0){
35 jiao=atan(y/x)+pi;
36 }else if((y/x)<0&&y<0){
37 jiao=atan(y/x)+2*pi;
38 }else if((y/x)<0&&x<0){
39 jiao=atan(y/x)+pi;
40 }else if(x==0&&y>0){
41 jiao=pi/2;
42 }else if(x==0&&y<0){
43 jiao=(pi*3)/2;
44 }else if(y==0&&x<0){
45 jiao=pi;
46 }else if(y==0&&x>0){
47 jiao=0;
48 }
49 int j=jiao/fen;
50 ans+=((j+1)*2);
51 }else if(r > d*d && r < s*s){
52 if((y/x)>0&&y>0){
53 jiao=atan(y/x);
54 }else if((y/x)>0&&y<0){
55 jiao=atan(y/x)+pi;
56 }else if((y/x)<0&&y<0){
57 jiao=atan(y/x)+2*pi;
58 }else if((y/x)<0&&x<0){
59 jiao=atan(y/x)+pi;
60 }else if(x==0&&y>0){
61 jiao=pi/2;
62 }else if(x==0&&y<0){
63 jiao=(pi*3)/2;
64 }else if(y==0&&x<0){
65 jiao=pi;
66 }else if(y==0&&x>0){
67 jiao=0;
68 }
69 int j=jiao/fen;
70 ans+=(j+1);
71 }else{
72 ans += 0;
73 }
74 }
75 printf("%lld\n",ans);
76 }
77 }
04.06 UCF Local Programming Contest 2017的更多相关文章
- 2020.4.6--UCF Local Programming Contest 2017的正式赛
Problem A : Electric Bill 题目大意:进行电量分级制收费,1000kwh及以下一档收费,1000kwh以上按另一档收费,给出每个人的电量总额,问每人应支付多少钱. 思路:基础i ...
- UCF Local Programming Contest 2016 J题(二分+bfs)
题目链接如下: https://nanti.jisuanke.com/t/43321 思路: 显然我们要采用二分的方法来寻找答案,给定一个高度如果能确定在这个高度时是否可以安全到达终点,那我们就可以很 ...
- 03.28,周六,12:00-17:00,ICPC训练联盟周赛,选用试题:UCF Local Programming Contest 2016正式赛。
A. Majestic 10 题意:三个数均大于10则输出"triple-double",如果两个数大于10则输出"double-double",如果一个大于1 ...
- 03.21 ICPC训练联盟周赛:UCF Local Programming Contest 2018正式赛
B Breaking Branches 题意:两个人比赛折枝,谁剩下最后1,无法折出整数即为输 思路:树枝长n,若是奇数,则Bob胜出,若是偶数,则Alice胜出,且需要输出1: 1 #include ...
- 2020.3.28-ICPC训练联盟周赛,选用试题:UCF Local Programming Contest 2016
A.Majestic 10 签到题. #include<iostream> #include<cstdio> #include<cstring> #include& ...
- The North American Invitational Programming Contest 2017 题目
NAIPC 2017 Yin and Yang Stones 75.39% 1000ms 262144K A mysterious circular arrangement of black st ...
- ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2017)- K. Poor Ramzi -dp+记忆化搜索
ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2017)- K. ...
- 2016-2017 CT S03E05: Codeforces Trainings Season 3 Episode 5 (2016 Stanford Local Programming Contest, Extended) E
链接:http://codeforces.com/gym/101116 学弟写的,以后再补 #include <iostream> #include <algorithm> # ...
- 2016-2017 CT S03E05: Codeforces Trainings Season 3 Episode 5 (2016 Stanford Local Programming Contest, Extended) J
链接:http://codeforces.com/gym/101116 题意:给出n个点,要求一个矩形框将(n/2)+1个点框住,要面积最小 解法:先根据x轴选出i->j之间的点,中间的点(包括 ...
随机推荐
- P1996_约瑟夫问题(JAVA语言)_可能是最简单的解法了!
思路:使用队列模拟. 判断是否为出圈的数.如果不是,把数加入队列尾部:如果是,输出并删除. 题目背景 约瑟夫是一个无聊的人!!! 题目描述 n个人(n<=100)围成一圈,从第一个人开始报数,数 ...
- ch2_8_3求解回文序列问题(递归实现)
思路:回文序列中左右两边的值一定相等,所以可以将该问题分解为两边化为相同元素操作的次数和去掉两边相等元素后后剩下元素变成回文序列的操作次数. 题目: 如果一个数字序列逆置之后跟原序列是一样的就称这样的 ...
- 归并排序(JAVA语言)
public class merge { public static void main(String[] args) { // TODO Auto-generated method stub int ...
- 设计模式——从工厂方法模式到 IOC/DI思想
回顾简单工厂 回顾:从接口的角度去理解简单工厂模式 前面说到了简单工厂的本质是选择实现,说白了是由一个专门的类去负责生产我们所需要的对象,从而将对象的创建从代码中剥离出来,实现松耦合.我们来看一个例子 ...
- pwn题命令行解题脚本
目录 脚本说明 脚本内容 使用 使用示例 参考与引用 脚本说明 这是专门为本地调试与远程答题准备的脚本,依靠命令行参数进行控制. 本脚本支持的功能有: 本地调试 开启tmux调试 设置gdb断点,支持 ...
- 基于k8s的集群稳定架构-转载
基于k8s的集群稳定架构-转载 前言 我司的集群时刻处于崩溃的边缘,通过近三个月的掌握,发现我司的集群不稳定的原因有以下几点: 1.发版流程不稳定 2.缺少监控平台[最重要的原因] 3.缺少日志系统 ...
- 一文带大家彻底搞懂Hystrix!
前言? Netflix Hystrix断路器是什么? Netflix Hystrix是SOA/微服务架构中提供服务隔离.熔断.降级机制的工具/框架.Netflix Hystrix是断路器的一种实现,用 ...
- 一、python学习-基础语法
1.计算机文件大小单位 b = bit 位(比特) 位代表 0 1 B = Byte字节 1Byte = 8 bit //一个字节等于8位 1KB = 1024B 1MB = 1024KB 1GB = ...
- 1016 Phone Bills
A long-distance telephone company charges its customers by the following rules: Making a long-distan ...
- Weekly Contest 184
1408. String Matching in an Array Given an array of string words. Return all strings in words which ...