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的更多相关文章

  1. 2020.4.6--UCF Local Programming Contest 2017的正式赛

    Problem A : Electric Bill 题目大意:进行电量分级制收费,1000kwh及以下一档收费,1000kwh以上按另一档收费,给出每个人的电量总额,问每人应支付多少钱. 思路:基础i ...

  2. UCF Local Programming Contest 2016 J题(二分+bfs)

    题目链接如下: https://nanti.jisuanke.com/t/43321 思路: 显然我们要采用二分的方法来寻找答案,给定一个高度如果能确定在这个高度时是否可以安全到达终点,那我们就可以很 ...

  3. 03.28,周六,12:00-17:00,ICPC训练联盟周赛,选用试题:UCF Local Programming Contest 2016正式赛。

    A. Majestic 10 题意:三个数均大于10则输出"triple-double",如果两个数大于10则输出"double-double",如果一个大于1 ...

  4. 03.21 ICPC训练联盟周赛:UCF Local Programming Contest 2018正式赛

    B Breaking Branches 题意:两个人比赛折枝,谁剩下最后1,无法折出整数即为输 思路:树枝长n,若是奇数,则Bob胜出,若是偶数,则Alice胜出,且需要输出1: 1 #include ...

  5. 2020.3.28-ICPC训练联盟周赛,选用试题:UCF Local Programming Contest 2016

    A.Majestic 10 签到题. #include<iostream> #include<cstdio> #include<cstring> #include& ...

  6. The North American Invitational Programming Contest 2017 题目

    NAIPC 2017 Yin and Yang Stones 75.39% 1000ms 262144K   A mysterious circular arrangement of black st ...

  7. 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. ...

  8. 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> # ...

  9. 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之间的点,中间的点(包括 ...

随机推荐

  1. java例题_43 求0—7所能组成的奇数个数

    1 /*43 [程序 43 求奇数个数] 2 题目:求 0-7 所能组成的奇数个数. 3 */ 4 5 /*分析 6 * 1.0不能作最高位且最低位只能是1,3,5,7; 7 * 2.没有限定是几位数 ...

  2. ZooKeeper 会话的秘密

    本文作者:HelloGitHub-老荀 Hi,这里是 HelloGitHub 推出的 HelloZooKeeper 系列,免费开源.有趣.入门级的 ZooKeeper 教程,面向有编程基础的新手. 项 ...

  3. Kafka又出问题了!

    写在前面 估计运维年前没有祭拜服务器,Nginx的问题修复了,Kafka又不行了.今天,本来想再睡会,结果,电话又响了.还是运营,"喂,冰河,到公司了吗?赶紧看看服务器吧,又出问题了&quo ...

  4. Redis持久化——内存快照(RDB)

    最新:Redis持久化--如何选择合适的持久化方式 最新:Redis持久化--AOF日志 最新:Redis持久化--内存快照(RDB) 一文回顾Redis五大对象(数据类型) Redis对象--有序集 ...

  5. servlet学习(一)

    Tomcat 注:以下资料摘自孙鑫的<sevlet/JSP深入详解>,仅用于个人学习使用. 一.web技术的发展 早期web是静态页面的浏览,使用HTML编写,放入服务器. 1.1浏览器请 ...

  6. C++并发与多线程学习笔记--参数传递详解

    传递临时对象 陷阱 总结 临时对象作为线程参数 线程id的概念 临时对象构造时的抓捕 成员函数指针做线程函数 传递临时对象作为线程参数 创建的工作线程不止一个,线程根据编号来确定工作内容.每个线程都需 ...

  7. libnet的使用详解

    最近搬砖需要对libnet进行介绍在这里对知识进行汇总. 1.libnet简介 在libnet出现以前,如果要构造数据包并发送到网络中,程序员要通过一些复杂的接口来处理.libnet的出现,为程序员提 ...

  8. day-7 xctf-level2

    xctf-level2 题目传送门:https://adworld.xctf.org.cn/task/answer?type=pwn&number=2&grade=0&id=5 ...

  9. 在Win10中手动添加/修改本地IP

    1 前言 好久没动Win10了... 今天需要用Win10做一下实验,手动修改IP,于是写下了这篇文章作为过程记录. 2 概述 Win10里面修改本地IP不是一件特别困难的事,简单来说可以分为两种方式 ...

  10. 计算eks node 中pod数量

    计算eks node 中pod数量 计算公式:((IP数I - 1) * ENI数) + 2 实例规格等ENI数和IP的对应关系,请参考 https://docs.aws.amazon.com/zh_ ...