【入门5】字符串(今天刷洛谷了嘛)

几道纯模拟题没有写,暂且先放一下

P5733

【深基6.例1】自动修正 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
char s[N];
int main()
{
	cin>>s;
	int n = strlen(s);
	for(int i = 1;i='a'&&s[i]<='z')
		s[i] = char(s[i]-32);
	}
	cout<

P1914

小书童——凯撒密码 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
char s[N];
int main()
{
	ios;
	//cout<>n;
	cin>>s;
	int num = strlen(s);
	for(int i = 0;i

P1125

[NOIP2008 提高组] 笨小猴 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
char s[109];
int ad[30];
int main()
{
	ios;
	cin>>s;
	int n = strlen(s);
	for(int i = 0;i

P1957

口算练习题 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
int main()
{
	ios;
	int t;
	cin>>t;	
	char op;
	while(t--)
	{
		char s[10];
		cin>>s;
		int a = 0,b;
		if(s[0]>='0'&&s[0]<='9')
		{
			cin>>b;
			int n = strlen(s);
			int p = 1;
			for(int i = n-1;i>=0;i--)
			{
				a += (s[i]-'0')*p;
				p*=10;
			}
		}
		else
		{
			op = s[0];
			cin>>a>>b;
		}
		
		int num = 0;
		if(a<10&&a>=0)	num+=1;
		else if(a<100&&a>=10)	num+=2;
		else if(a<1000&&a>=100)		num+=3;
		else	num+=4;
		
		if(b<10&&b>=0)	num+=1;
		else if(b<100&&b>=10)	num+=2;
		else if(b<1000&&b>=100)		num+=3;
		else	num+=4;
		int ans;
		if(op=='a')	ans = a+b;
		else if(op=='b')	ans = a-b;
		else if(op=='c')	ans = a*b;
		if(ans<0)	num+=3;
		else	num+=2;
		
		cout<

P1308

[NOIP2011 普及组] 统计单词数 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
int main()
{
	string a,b;
	getline(cin,a);
	getline(cin,b);
	for(int i = 0;i

P1765

手机 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
int main()
{
	string s;
	getline(cin,s);
	int ans = 0;
	for(int i = 0;i

P3741

honoka的键盘 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
char s[109];
int main()
{
	ios;
	int n;
	cin>>n;
	cin>>s;
	int ans = 0;
	for(int i = 0;i

P1321

单词覆盖还原 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
char s[260];
int main()
{
	cin>>s;
	int n = strlen(s);
	int a = 0,b = 0;
	for(int i = 0;i

P1200

[USACO1.1]你的飞碟在这儿Your Ride Is Here 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
char s[260];
int main()
{
	string a,b;
	cin>>a>>b;
	ll pr = 1;
	ll hx = 1;
	for(int i = 0;i

P1598

垂直柱状图 

#include
#include
#include
#include
#include
#include 
#include
#include 
using namespace std;
typedef long long  ll;
const int inf = 0x3f3f3f3f;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6+5;
int q[26];
int main()
{
	int t = 4;
	while(t--)
	{
		string s;
		getline(cin,s);
		for(int i = 0;i='A'&&s[i]<='Z')
			{
				q[s[i]-'A']++;
			}
		}
	}
	
	int mx = 0;
	for(int i = 0;i<26;i++)
	{
		mx = max(mx,q[i]);
	}
	for(int i = mx;i>=1;i--)
	{
		for(int j = 0;j<26;j++)
		{
			if(q[j]>=i)
			cout<<'*';
			else
			cout<<' '; 
			if(j!=25)
			cout<<' ';	
		}
		cout<<"\n";
	}
	cout<<"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"<<"\n";
}

你可能感兴趣的:(60天洛谷挑战flag,蓝桥杯,c++,职场和发展)