当前位置:网站首页>Blue Bridge Cup study 2022.7.5 (morning)
Blue Bridge Cup study 2022.7.5 (morning)
2022-07-05 13:49:00 【megaData】
String part :
#include<iostream>
#include<string>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
string space = string(n-i,' ');
// Space
string ch = string(2*i-1,'A'+i-1);
// character
cout<<space+ch<<endl;
}
return 0;
}
#include<iostream>
using namespace std;
int main()
{
char c;
cin>>c;
// The input is a number (1 To 9) Or letters (A To Z)
if(c>='A'&&c<='Z')
{
for(int i=1;i<=c-'A'+1;i++)
// Control the number of lines
{
for(int j=1;j<=c-'A'+1-i;j++)
{
cout<< " ";
}
// The output order of letters is to increase first and then decrease
for(int j=1;j<=i;j++)
{
cout<<(char)('A'+j-1);
}
for(int j=i-1;j>=1;j--)
{
cout<<(char)('A'+j-1);
}
cout<<endl;
}
}
else
{
for(int i=1;i<=c-'1'+1;i++)
{
for(int j=1;j<=c-'1'+1-i;j++)
{
cout<< " ";
}
for(int j=1;j<=i;j++)
{
cout<<(char)('1'+j-1);
}
for(int j=i-1;j>=1;j--)
{
cout<<(char)('1'+j-1);
}
cout<<endl;
}
}
return 0;
}// Symmetric strings
#include<stdio.h>
#include<string.h>
char res[5000000];
int main()
{
int n;
scanf("%d",&n);
int len=0;
for(int i=1;i<=n;i++)
//0 To len-1
{
// stay len There is a space here
strcat(res+len+1 ,res);
res[len]='A'+i-1;
len=strlen(res);
}
printf("%s\n",res);
return 0;
}
//A
//ABA
//ABACABA
//ABACABADABACABA#include<cstdio>
#include<cstring>
char s1[1005],s2[1005];
int main()
{
fgets(s1,1004,stdin);
fgets(s2,1004,stdin);
//fgets The length of the newline will be added at the end
int len1 = strlen(s1)-1,len2 = strlen(s2)-1;
// You need to subtract the length of the newline
int ans = 0;
for(int i=0;i+len2-1<len1;i++)
{
bool matched = true;
for(int j=0;j<len2;j++)
{
if(s1[i+j]!=s2[j])
{
matched=false;
break;
}
}
if(matched)
{
ans++;
}
}
printf("%d\n",ans);
return 0;
}边栏推荐
- Etcd database source code analysis -- rawnode simple package
- Internal JSON-RPC error. {"code":-32000, "message": "execution reverted"} solve the error
- PHP basic syntax
- [public class preview]: basis and practice of video quality evaluation
- 53. 最大子数组和:给你一个整数数组 nums ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
- zabbix 监控
- 法国学者:最优传输理论下对抗攻击可解释性探讨
- Wonderful express | Tencent cloud database June issue
- stm32逆向入门
- jasypt配置文件加密|快速入门|实战
猜你喜欢

Nantong online communication group

Solve the problem of invalid uni app configuration page and tabbar

Godson 2nd generation burn PMON and reload system

Set up a website with a sense of ceremony, and post it to the public 2/2 through the intranet

:: ffff:192.168.31.101 what address is it?

NFT value and white paper acquisition
![[notes of in-depth study paper]transbtsv2: wider instead of deep transformer for medical image segmentation](/img/70/6de0346df8527af6c88db1ff89947b.png)
[notes of in-depth study paper]transbtsv2: wider instead of deep transformer for medical image segmentation

Convolutional Neural Networks简述

Ordering system based on wechat applet

STM32 reverse entry
随机推荐
asp.net 读取txt文件
laravel-dompdf导出pdf,中文乱码问题解决
:: ffff:192.168.31.101 what address is it?
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
Source code analysis of etcd database -- peer RT of inter cluster network layer client
Prefix, infix, suffix expression "recommended collection"
Idea remote debugging agent
ETCD数据库源码分析——rawnode简单封装
Hide Chinese name
[notes of in-depth study paper]transbtsv2: wider instead of deep transformer for medical image segmentation
锚点导航小demo
Idea set method annotation and class annotation
Ordering system based on wechat applet
Redis6 transaction and locking mechanism
kafaka 日志收集
Laravel框架运行报错:No application encryption key has been specified
Kafaka log collection
asp. Net read TXT file
【云资源】云资源安全管理用什么软件好?为什么?
Win10 - lightweight gadget