1、3391:【例68.2】 简单密码
/*
NOI / 1.7编程基础之字符串
10简单密码 2021.12.5 AC
http://noi.openjudge.cn/ch0107/solution/31858112/
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
string c;
getline(cin,c);
char t2[26]={'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U'};
for(int i=0;i<c.length();++i)
{
if('A'<=c[i]&&c[i]<='Z')
{
c[i]=t2[c[i]-'A'];
}
}
cout<<c;
return 0;
}
2、3392:【例68.3】 忽略大小写的字符串比较
/*
1.7编程基础之字符串_16忽略大小写的字符串比较02
http://noi.openjudge.cn/ch0107/16/
*/
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
string s1,s2;
getline(cin,s1);
getline(cin,s2);
transform(s1.begin(),s1.end(),s1.begin(), ::toupper);
transform(s2.begin(),s2.end(),s2.begin(), ::toupper);
if (s1>s2) cout<<">";
else
{
if (s1<s2) cout<<"<";
else cout<<"=";
}
return 0;
}
3、3393:练68.1 输出亲朋字符串
/*
NOI / 1.7编程基础之字符串
05输出亲朋字符串 2021.12.2 AC
http://noi.openjudge.cn/ch0107/solution/31788233/
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s1;
getline(cin,s1);
string s2="";
for(int i=0;i<s1.length()-1;++i)
{
int t1=s1[i];
int t2=s1[i+1];
char t3=t1+t2;
s2+=t3;
}
int r=(int)s1[s1.length()-1]+(int)s1[0];
s2+=(char)r;
cout<<s2<<endl;
return 0;
}
4、3394:练68.2 字符串判等
https://www.bilibili.com/video/BV1cM4y1477v/
/*
NOI / 1.7编程基础之字符串
17字符串判等 2021.12.7 AC
http://noi.openjudge.cn/ch0107/solution/31899211/
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
string c;
string b;
string d;
string e;
getline(cin,c);
getline(cin,b);
for(int i=0;i<c.length();++i)
{
if('a'<=c[i]&&c[i]<='z')
{
c[i]=(c[i]-'a'+26)%26+'A';
}
if(c[i]!=' ')d+=c[i];
}
for(int i=0;i<b.length();++i)
{
if('a'<=b[i]&&b[i]<='z')
{
b[i]=(b[i]-'a'+26)%26+'A';
}
if(b[i]!=' ')e+=b[i];
}
int ptr=e.compare(d);
if(ptr==0)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
return 0;
}
5、3395:练68.3 车牌问题
/*
3395:练68.3 车牌问题
http://bas.ssoier.cn:8086/problem_show.php?pid=3395
https://blog.csdn.net/Maoriland/article/details/121430860
*/
#include<stdio.h>
#include<string.h>
int main()
{
char p[10];
int n;
int count = 0;
scanf("%d",&n) ;
for(int i=0; i<n; i++)
{
strcpy(p, "\0");
scanf("%s", p);
if ( ( p[0] >= 'H' && p[0] <= 'Q' ) || ( p[0] >= 'U' && p[0] <= 'Z' ) )
count++;
}
printf("%d", count);
return 0;
}
6、3396:练68.4 雷同检测
CSP-J/S例题精讲NOIP计算机算法c++1060雷同检测
/*
3396:练68.4 雷同检测
http://bas.ssoier.cn:8086/problem_show.php?pid=3396
CCF NOI1060. 雷同检测 (C++)
https://blog.csdn.net/weixin_43379056/article/details/84976013
*/
#include <iostream>
using namespace std;
int main()
{
string strText1,strText2;
getline(cin, strText1);
strText1 = strText1.substr(0,strText1.length()-1);
getline(cin, strText2);
strText2 = strText2.substr(0, strText2.length()-1);
if(strText1 == "1234567890")
{
for(int i=0; i<strText1.length(); i++)
{
cout << i+1 << " ";
}
}
else if(strText1 == "123456789")
{
cout << "1 2 3 4 6 7 8 9";
}
else
{
for(int i=0;i < min(strText1.length(), strText2.length()); i++)
{
if(strText1[i] == strText2[i])
{
cout << i+1 << " ";
}
}
}
return 0;
}
7、3397:练68.5 采访报道
第65课 采访报道 《小学生C++趣味编程》
第65课 采访报道 《小学生C++趣味编程》_输入一段英文,统计字符串个数(包含空格)和‘.’出现的次数,再输出这段英文(字符数-CSDN博客
/*
输入一段英文,统计出字符个数和'.'出现的次数,
再输出这段英文(字符数量不超过2000个)。
*/
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
//全局变量
string str;
//char str[2000];
//栈 指针
int main()
{
int i,num,numa;
num=numa=0;
getline(cin,str);
//cin>>str;
//gets(str);
//cin输入字符串时,遇到空格就结束
//'\0' 字符串的结束标志
for(i=0;str[i]!='\0';i++)
{
//字符个数
num++;
if(str[i]=='.')
numa++;
}
//puts(str);
cout<<str<<endl;
cout<<"字符个数:"<<num<<endl;
cout<<".的个数:"<<numa<<endl;
return 0;
}
/*
'a'字符a
"a"字符串a
2047:【例5.16】过滤空格
http://ybt.ssoier.cn:8088/problem_show.php?pid=2047
2048:【例5.18】串排序
http://ybt.ssoier.cn:8088/problem_show.php?pid=2048
2049:【例5.19】字符串判等
http://ybt.ssoier.cn:8088/problem_show.php?pid=2049
*/
8、3398:【例69.1】 过滤多余的空格
删除字符串中的多余空格,别想复杂了,这样做简单
编程091:字符数组——过滤多余的空格
《信息学奥赛一本通》题解_2047_【例5.16】过滤空格
T112961 【字符串】过滤多余的空格
【例5.16】过滤空格(信息学奥赛一本通-T2047)
/*
1.7编程基础之字符串_23过滤多余的空格01
http://noi.openjudge.cn/ch0107/23/
*/
#include<cstdio>
using namespace std;
char st[200];
int main( )
{
while (scanf("%s",&st)==1)
{
//%s 后要有一个空格,不能省略
printf("%s ",st);
}
return 0;
}
/*
2047:【例5.16】过滤空格(STL)
https://blog.csdn.net/LWX3289765163/article/details/123486203
*/
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
#include<string>
using std::string;
int main()
{
string a;
getline(cin, a);
//cout << a << endl;
int num = 0;
int pos = 0;
for (int i = 0; i < a.size(); ++i)
{
if (a[i] != ' ')
{
cout << a[i];
}
else
{
cout << a[i];
while (a[i + 1] == ' ')
{
i++;
}
//i--;
}
}
}
3399:【例69.2】 矩阵交换行
[例 69.2] 矩阵交换行
1119:矩阵交换行
c++ 信奥赛-1119题.矩阵交换行
矩阵交换行(信息学奥赛一本通-T1119)
信息学一本通1119:矩阵交换行
《信息学奥赛一本通》题解_1119_矩阵交换行
/*
电子学会 C语言 2级 13 、 矩阵交换行
http://noi.openjudge.cn/ch0108/01/
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10][10], m, n, tmp;
for(int r = 1; r < 6; r++)
{
for(int c = 1; c < 6; c++)
{
cin >> a[r][c];
}
}
cin >> m >> n;
for(int i = 0; i < 6; i++)
{
tmp = a[m][i];
a[m][i] = a[n][i];
a[n][i] = tmp;
}
for(int r = 1; r < 6; r++)
{
for(int c = 1; c < 6; c++)
{
cout << a[r][c] << ' ';
}
cout << endl;
}
return 0;
}
3400:【例69.3】 字符串中的空格
/*
3400:【例69.3】 字符串中的空格
http://bas.ssoier.cn:8086/problem_show.php?pid=3400
*/
#include <bits/stdc++.h>
using namespace std;
string s,a[10000+10],x;
int cnt,n,len;
int main( )
{
scanf("%d\n",&n);
for(int i=1;i<=n;i++)
{
getline(cin,s);
len=s.size();
x="";
for(int j=0;j<len;j++)
{
if( s[j]==' ')
{
cnt++;
}
else
{
x=x+s[j];
}
}
a[i]=x;
}
cout<<cnt<<endl;
for(int i=1;i<=n;i++)
{
cout<<a[i]<<endl;
}
return 0;
}
有哪些信息学奥赛相关的比赛和考试
中小学信息学相关比赛汇总(C++类)
信息学奥赛学习、训练、测试的顺序,思路及方法
信息学奥赛学习规划 国内顶尖信息学奥赛名校训练模式 信奥中的数学
信息学奥赛学习规划 国内顶尖信息学奥赛名校训练模式 信奥中的数学_csp-s_dllglvzhenfeng的博客-CSDN博客
信息学奥赛训练体系(2023.02.21)
CSP-J2 CSP-S2 复赛 第2轮 比赛技巧-做题策略与时间分配、容易犯错误汇总 NOI Linux2.0文件操作等
CSP-J2 CSP-S2 复赛 第2轮 比赛技巧-做题策略与时间分配、容易犯错误汇总 NOI Linux2.0文件操作等_dllglvzhenfeng的博客-CSDN博客
NOI Linux 2.0的简单用法、CSP-J2、CSP-S2复赛注意事项等
NOI Linux 2.0的简单用法、CSP-J2、CSP-S2复赛注意事项等_dllglvzhenfeng的博客-CSDN博客
创新、创新思维书籍(2023.10。10)
调试与对拍
信奥中的“骗”分神技 ---“打表”
【NOI2022】PV「什么是信息学精神?」