A - Pangram :判断一个字符串中有木有出现过26个字母,不论大小写,有YES没有NO

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>using namespace std;#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
#define pi acos(-1.0)
#define eps 1e-8
typedef long long ll;
const int inf = 0x3f3f3f3f;char a[1000];
int cnt;
int vis[30];int main()
{int n;while( ~scanf("%d", &n )){scanf("%s", a);if( n < 26 ){cout << "NO" << endl;continue;}cnt = 0;int len = strlen( a );memset( vis, 0, sizeof( vis ));for( int i = 0; i < len; i++ ){if( a[i] <= 'z' && a[i] >= 'a' ){if( !vis[ a[i] - 'a' ] ){cnt++;vis[ a[i] -'a' ] = 1;}}else{if( !vis[ a[i] - 'A'] ){cnt++;vis[ a[i] - 'A' ] = 1;}}}if( cnt == 26 )puts("YES");elseputs("NO");}return 0;
}

B - Two Buttons  n变到m,要么乘以2,要么减去1,的最小步数。简单bfs

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>using namespace std;#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
#define pi acos(-1.0)
#define eps 1e-8
typedef long long ll;
const int inf = 0x3f3f3f3f;int n, m;struct nod{int x, s;
};
int vis[100010];queue <nod> q;int bfs( int st, int ed )
{while( !q.empty() )q.pop();memset( vis, 0, sizeof( vis ) );nod t;t.x = st, t.s = 0;vis[st] = 1;q.push( t );while( !q.empty() ){nod now = q.front();q.pop();if( now.x == ed ){return now.s;}nod nxt;nxt.s = now.s + 1;if( !vis[ now.x << 1] && ( now.x << 1 ) <= 10000 )//注意不能超过范围{nxt.x = now.x << 1;q.push( nxt );vis[nxt.x] = 1;}if( !vis[ now.x - 1 ] ){nxt.x = now.x - 1;if( nxt.x < 0 )continue;q.push( nxt );vis[nxt.x] = 1;}}
}int main()
{while( ~scanf("%d%d", &n, &m)){if( n <= 0 ){cout << "0" << endl;continue;}if( m <= n ){printf("%d\n", n - m);continue;}int ans = bfs( n, m );cout << ans << endl;}return 0;
}

C - DNA Alignment h函数是两个相同长度的字符串,在同位置相同字符的数量,p函数是循环移位后得到的总和,然后给出S串求使p函数最大的T串有几个。

首先得到T串里的字符就是S里面字符出现最多的字符,当有多个字符出现次数一样的话,那么该位置填哪个都没关系了,又因为有n位,所以最后结果就是出现的最大次数的字母的^n

#include <set>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const double eps = 1e-15;
const int mod = 1e9 + 7;
typedef long long LL;
typedef pair <int, int> PLL;char str[100110];
int num[100];int main ()
{int n;while (~scanf("%d", &n)){int maxs = 0;scanf("%s", str);memset (num, 0, sizeof(num));for (int i = 0; i < n; ++i){++num[str[i]];maxs = max (maxs, num[str[i]]);}int cnt = 0;if (num['A'] == maxs){++cnt;}if (num['G'] == maxs){++cnt;}if (num['T'] == maxs){++cnt;}if (num['C'] == maxs){++cnt;}LL ans = 1;for (int i = 1; i <= n; ++i){ans *= (LL)cnt;ans %= mod;}cout << ans << endl;}return 0;
}

Codeforces Round #295 (Div. 2) ABC相关推荐

  1. Educational Codeforces Round 112(Div.2) ABC题解

    D题好像可以做一做,挖个坑以后做好了来填(doge Educational Codeforces Round 112(Div.2) 题目列表 1.A 2.B 3.C 1.A 原题链接 题目大意 有三种 ...

  2. Codeforces Round #783 (Div. 2)和Codeforces Round #784 (Div. 4)---- ABC | ABCDEF

    目录 Codeforces Round #783 (Div. 2) A B C Codeforces Round #784 (Div. 4) A B C D E F Codeforces Round ...

  3. Codeforces Round #712 (Div. 2)-ABC

    A. Déjà Vu A palindrome is a string that reads the same backward as forward. For example, the string ...

  4. Codeforces Round #783 (Div. 2) ABC

    自从上个月得了麦粒肿,又遇上入D的一系列麻烦事儿,心态爆炸,状态开始摆烂,摆完蓝桥杯,摆完昆明站,终于在这几天感觉状态逐渐好转... 冲冲冲! ​​​​​​​​​​​Problem - A - Cod ...

  5. Codeforces Round #561 (Div. 2)ABC

    三个题,各位大佬别喷我,我很菜 A Silent Classroom There are n students in the first grade of Nlogonia high school. ...

  6. Codeforces Round #295 (Div. 1) C. Pluses everywhere

    昨天ZZD大神邀请我做一道题,说这题很有趣啊. 哇,然后我被虐了. Orz ZZD 题目大意: 你有一个长度为n的'0-9'串,你要在其中加入k个'+'号,每种方案就会形成一个算式,算式算出来的值记做 ...

  7. CodeCraft-21 and Codeforces Round #711 (Div. 2)ABC题解

    A题,至少能找到个gcd=2gcd=2gcd=2的,只要222个都是偶数就行 #include<bits/stdc++.h> using namespace std; typedef lo ...

  8. Codeforces Round #698 (Div. 2)(A ~ F)6题全,超高质量题解)【每日亿题】2021/2/4

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 [每日亿题]Codeforces Round #698 (Div. 2)(A ~ F)6题全,超 ...

  9. Codeforces Round #225 (Div. 1) E. Vowels 容斥 + sosdp

    传送门 文章目录 题意: 思路: 题意: 给你nnn个长度为333的串,串的每个字母都在a−za-za−z范围内,定义一个串合法当且仅当这个串中含有至少一个元音字母.现在他忘记了元音字母都有那几个,显 ...

最新文章

  1. paddle deepspeech v2 转 pytorch
  2. DL-1 用一元二次方程 y=x^2+b 构建神经网络
  3. springboot实现多线程service实现
  4. 《深入浅出数据分析》为读者送上了章回小说的精彩
  5. C++ STL 乱序算法
  6. GEE主成分分析全解析
  7. Docker部署homeassitant
  8. 电脑无法查看计算机属性,我的电脑属性打不开怎么办
  9. .bat脚本初体验——使用批处理bat清洗文件名
  10. 《眼儿媚·愁云淡淡雨潇潇》
  11. PowerQuery操作分类3
  12. Spring Boot 中三种跨域场景总结
  13. html——网页上添加表格
  14. springmvc下载excel模板示例代码
  15. Voicemeeter - PC混音器
  16. JavaWeb - 网页 GZIP 压缩检测
  17. 未发现缺陷(NDF)定义及预防
  18. iOS 图表工具charts之LineChartView
  19. ESP8266 TCP客户端代码(自动连接,断开识别)
  20. Gazebo仿真激光SLAM

热门文章

  1. 8. R语言画:散点图、直方图、条形图、箱线图、小提琴图、韦恩图
  2. matlab可以做影像组学吗,影像组学分析与建模工具综述.PDF
  3. 计算机编程oop思想与老子道德经之无有万物
  4. CCleaner的运行问题详解
  5. python多目标跟踪卡尔曼滤波_卡尔曼滤波+单目标追踪+python-opencv
  6. 基于单片机的心率脉搏检测电路设计(#0200)
  7. 100首经典英文歌曲
  8. 文案再这么玩 非玩死文案不可!
  9. 【C语言指针题】编写函数实现在任意行、任意列的二维数组中寻找鞍点,行、列数均有主调函数传入。
  10. 【征集+投票】微信投票小程序,公众号投票,免费创建投票打分平台,免费微信投票平台、微信投票小程序、微信群投票