两琴键间的音为多少

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*0 3, 4 6 8 9 11 13 15,16 18 20 21 23 25 27,28
30 32 33 35 37 39,40 42 44 45 47 49 51,
52 54 56 57 59 61 63,64 66 68 69 71 73 75
,76 78 80 81 83 85 87,88*/#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string.h>
#include<string>
#include<cmath>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;/* 本来想着要判断各个字母的前缀,后来发现还可以跨组别来求相隔的半音,所以应该想到要直接用map把这个按键的名字当做一个下标存下来 现代音乐用七个英文字母 C D E F G A B(或其小写)来标记音名。
这七个不同高低的音,其相邻音之间的音高距离,有半音和全音之分,其中E与F 和 B与C 之间为半音关系,其余相邻音之间为全音关系。
现代钢琴键盘上的全音和半音
相邻两个琴键(包括白健和黑键)构成半音,相隔一个琴键的两键之间构成全音。*/
int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int case1;map<string,int>shu;//map按key的ascii进行排序,而不是按输入顺序 cin>>case1;string name[52]={"A_2","B_2","C_1","D_1","E_1","F_1","G_1","A_1","B_1","C","D","E","F","G","A","B","c","d","e","f","g","a","b","c^1","d^1","e^1","f^1","g^1","a^1","b^1","c^2","d^2","e^2","f^2","g^2","a^2","b^2","c^3","d^3","e^3","f^3","g^3","a^3","b^3","c^4","d^4","e^4","f^4","g^4","a^4","b^4","c^5"};int zhi[52]={0,3,4,6,8,9,11,13,15,16,18,20,21,23,25,27,28,30,32,33,35,37,39,40,42,44,45,47,49,51,52,54,56,57,59,61,63,64,66,68,69,71,73,75,76,78,80,81,83,85,87,88};for(int i=0;i<52;i++){shu.insert(make_pair(name[i],zhi[i]));}
//  for(map<string,int>::iterator it=shu.begin();it!=shu.end();it++){
//      cout<<it->first<<" "<<it->second<<endl;
//  }while(case1--) {string s1,s2;cin>>s1>>s2;cout<<abs(shu[s2]-shu[s1])<<endl;}
}

讨伐青蛙

这里的青蛙比较的神奇,每个青蛙有自身的稀有值和体积。其中稀有值越高的青蛙讨伐后获得报酬能够越多,体积越小的青蛙讨伐后获得的报酬也能越多。阿库娅与和真并不想错失这一个讨伐青蛙的机会,所以他们想尽可能的使自己所能获得报酬最大。这里可以认为他们的力量无穷大,想讨伐哪只青蛙就一定能讨伐成功(虽然不大现实)。
在讨伐量固定的情况下,阿库娅与和真制定了两个讨伐计划,第一个是令稀有值之和最大,第二个是令体积之和最小,请分别计算第一种计划的最大稀有值之和,还有第二种计划的最小的体积之和。
Input输入包含多组测试数据。第一行一个T(1≤????≤5)代表测试数据组数。之后每组测试数据开头包含两个正整数n,m (1≤????≤????≤100)代表青蛙的数量n和这次需要讨伐青蛙的总数m。之后会有n行,每行包含两个个正整数a, b(1≤????,????≤1012)分别代表每只青蛙的稀有值,体积。
Output对于每组测试数据输出两个正整数分别代表所能讨伐的最大稀有值之和与最小的体积之和。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
#include<algorithm>
typedef long long ll;
using namespace std;
const int maxn=110;
struct ani{ll x;ll y;}an[maxn];bool cmp1(ani a,ani b){return a.x>b.x;
}bool cmp2(ani a,ani b){return a.y<b.y;}int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int T,n,m;cin>>T;while(T--){ll ans=0,ans1=0;cin>>n>>m;for(int i=0;i<n;i++){cin>>an[i].x>>an[i].y;}sort(an,an+n,cmp1);for(int j=0;j<m;j++)ans+=an[j].x;cout<<ans<<" ";sort(an,an+n,cmp2);for(int j=0;j<m;j++)ans1+=an[j].y;cout<<ans1<<endl;}}

cet4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<iostream>
typedef long long ll;
using namespace std;
int main(){int T;ll a,b,c;ll ans;cin>>T;while(T--){cin>>a>>b>>c;if(((a-b)<1)&&c<=3500||(a-b)==0){cout<<"impossible"<<endl;}else{ans=3500/(a-b);if((3500%(a-b))>0)ans++;if(ans>c){cout<<"impossible"<<endl;}else{cout<<ans<<endl;}}} }/*
这一题一定要预判a-b的值是否为0
比如说:
①除以零
②数组越界:int a[3]; a[10000000]=10;
③指针越界:int * p; p=(int *)malloc(5 * sizeof(int)); *(p+1000000)=10;
④使用已经释放的空间:int * p; p=(int *)malloc(5 * sizeof(int));free(p); *p=10;
⑤数组开得太大,超出了栈的范围,造成栈溢出:int a[100000000];
*/

H. 天野阳菜的祈祷

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<map>
typedef long long ll;
using namespace std;
int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int case1;cin>>case1;while(case1--){string s,tmp;cin>>s;if(s=="Rough"){cin>>tmp;cout<<"It will be a hard work!"<<endl; }else if(s=="Sunny"){cout<<"Stay"<<endl;  }else{cout<<"Let us go!"<<endl;}}
}

I 2333

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include<iostream>
typedef long long ll;
using namespace std;
const int maxn=1e7+5;
int arr[maxn]={2,3,3};//数据开到1e4以上就不能在main函数里面定义数组了,否则程序会
//直接蹦 ,这一题打表来做
int main(){int T,case1;int cur=1;int last=2;int i=3; while(i<maxn){if(arr[last]==3){if(arr[cur]==3){arr[i]=2;arr[i+1]=2;arr[i+2]=2;i=i+3;  last+=3;}else{arr[i]=2;arr[i+1]=2;i=i+2;last+=2;}}else{if(arr[cur]==3){arr[i]=3;arr[i+1]=3;arr[i+2]=3;i=i+3;  last+=3;}else{arr[i]=3;arr[i+1]=3;i=i+2;last+=2;}}cur++;}//  for(int i=0;i<10000;i++)cout<<arr[i]<<" ";cin>>T;while(T--){cin>>case1;cout<<arr[case1-1]<<endl;    }}
解法二:
#include<bits/stdc++.h>
using namespace std;
const int xa=1e7+5;
int a[xa];
int main()
{int p;cin>>p;a[0]=2;int pan=1;int shu=0;int i=0;while(shu<xa){if(a[i]==2){int t=2;while(t--){if(pan%2==1){a[++shu]=3;}else{a[++shu]=2;}}pan++;}if(a[i]==3){int t=3;while(t--){if(pan%2==1){a[++shu]=3;}else{a[++shu]=2;}}pan++;}i++;}int x;while(p--){cin>>x;cout<<a[x-1]<<endl;}}

qlu_新生赛_2019相关推荐

  1. qlu_新生赛_2018_代码汇总

    https://blog.csdn.net/weixin_43537190/article/details/84570246 记得看看梁延杰的blog 可能会有小惊喜 还有就是别的学校的新生题 本文章 ...

  2. [SUCTF2018]babyre [ACTF新生赛2020]fungame

    文章目录 [SUCTF2018]babyre 惯用思维 常人思维 GAMEOVER [ACTF新生赛2020]fungame int __cdecl sub_401340(int a1) int __ ...

  3. BUUCTF Web [ACTF2020 新生赛]Exec

    「作者主页」:士别三日wyx   此文章已录入专栏<网络攻防>,持续更新热门靶场的通关教程 「未知攻,焉知收」,在一个个孤独的夜晚,你完成了几百个攻防实验,回过头来才发现,已经击败了百分之 ...

  4. BUUCTF Web [ACTF2020 新生赛]Include

    「作者主页」:士别三日wyx   此文章已录入专栏<网络攻防>,持续更新热门靶场的通关教程 「未知攻,焉知收」,在一个个孤独的夜晚,你完成了几百个攻防实验,回过头来才发现,已经击败了百分之 ...

  5. 小乐乐与二段数(2019哈理工新生赛第20题)

    链接:2019哈理工新生赛题解 2019哈理工新生赛第20题 T题: 链接:https://ac.nowcoder.com/acm/contest/1877/T 来源:牛客网 题目描述 小乐乐从老师口 ...

  6. 2019年安徽大学ACM/ICPC实验室新生赛题解

    本文仅作个人收藏学习使用 题目及解析来源牛客竞赛网 //作者:王清楚 //链接:https://ac.nowcoder.com/discuss/351408?type=101&order=0& ...

  7. CTF新生赛之Writeup

    CTF新生赛之Writeup 作为零基础的新生,也是在开学后才了解了CTF,感觉本次新生赛中颇有收获,也是应赛制要求,故写下这份WP,以纪念本人的第一次CTF竞赛. 回顾和感想 回顾本次的新生赛,难度 ...

  8. XUPT 新生赛题目总结

    XUPT 新生赛题目总结 题目 永远的王聪明王 菊花侠大战桃花怪 教官喊话 Time Management 小布特烦恼 菜学长的糖糖 水题 永远的王聪明王 简单的结构体排序,唯一要注意的是数据范围(时 ...

  9. 论如何举办一个承载400人的比赛(XUPT新生赛承办小记)

    XUPT新生赛承办小记 老师去年就想搞一个新生赛了,奈何去年时间不够,没有搞,于是今年就开始提前搞起来了.ZLS说要不然搞一个domjudge,我寻思着好鸭好鸭,看起来很牛逼,然后就开始了苦逼的配环境 ...

最新文章

  1. eclipse 里面 tomcat 或者其他web环境启动慢
  2. 2022-2028年中国医疗器械行业战略运营模式与典型案例分析报告
  3. 【NLP】一文搞懂NLP中的对抗训练
  4. c语言中通过分隔符取字符串,C语言切割多层字符串(strtok_r strtok使用方法)
  5. 第五章 计算机故障诊断与排除
  6. 如何查看linux 日志 磁盘使用情况?
  7. Java中大规模集合快速求和计算
  8. 【安全测试自学】初探web安全处测试(三)
  9. Go语言的context包从放弃到入门
  10. 循环上传导致oom_java之OOM排查
  11. 详解Python的max、min和sum函数用法
  12. qml入门学习(四):附加信号Component.onCompleted和Component.onDestruction
  13. python 开发工具_「干货」推荐一整套 Python 开发工具
  14. 排序算法Java实现(快速排序)
  15. SSH Backgroup工具汇总
  16. java8官网下载地址
  17. ‘在路上’问卷调查结果与分析
  18. 固态硬盘(SSD)原理及相关介绍
  19. 关于vs2005、vs2008和vs2010项目互转的总结
  20. Sql Server备份时提示:备份文件不可用,原先扇区为512,现在为4096

热门文章

  1. 繁华落尽,捡拾一地伤
  2. 如何安装webpack4
  3. 太极熊猫服务器怎么都在维护,太极熊猫3进不去怎么办 太极熊猫3登录不了解决方法-APK8安卓网...
  4. java和python应该学哪一个,纠结?
  5. SQL Server安装与使用(破解版)
  6. QQ音乐Android wear,LG W200智能手表入手,性价比极高的Android Wear
  7. php 默认字符cp936,字符编码cp936
  8. 天猫食品饮料数据分析:2月份茶饮料品牌销量TOP10排行榜!
  9. 【Geant4 from CERN】——Geant4的安装
  10. Vue 毫秒(秒)数值与日期转换