21 蓝桥杯

cpp 复制代码
#include<iostream>
using namespace std;
#include<string>
string str;
int main()
{
	cin >> str;
	for (int i = 0;i < str.length();i++)
	{
		int x = (int)str[i];
		if (x >= 49 && x <= 57)
		{
			x -= 49;
			for (int j = 1;j <= x;j++)
			{
				cout << str[i - 1];
			}
		}
		else
		{
			cout << str[i];
		}
	}
	return 0;
}
cpp 复制代码
#include<iostream>
using namespace std;
#include<string>
string str;
int main()
{
	long long a, b, n;
	cin >> a >> b >> n;
	long long week = a * 5 + b * 2;
	long long ans = 0;
	ans = n / week;
	ans *= 7;
	n %= week;
	int flag = 0;
	while (n > 0)
	{
		flag++;
		ans++;
		if (flag <= 5)
		{
			n -= a;
		}
		else
		{
			n -= b;
		}
	}
	cout << ans << endl;
	return 0;
}
cpp 复制代码
#include<iostream>
using namespace std;
#include<cmath>
#include<algorithm>
int main()
{
	double n;

	cin >> n;
	int nn = n;
	int ans = 0;
	for (int i = 1;i < n;i++)
	{
		int x = i * i;
		x %= nn;
		if ( x< n / 2)
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}
cpp 复制代码
#include<iostream>
using namespace std;
#include<cmath>
#include<algorithm>
int main()
{
	char ch1, ch2, ch3, ch4;
	int cnt = 0;
	for (int i = 1;i <= 5;i++)
	{
		cin >> ch1 >> ch2 >> ch3 >> ch4;
		if (ch1 == ch3 && (int)ch4 - (int)ch2 == 1)
		{
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}
cpp 复制代码
#include<iostream>
using namespace std;
#include<cmath>
#include<algorithm>
#include<iomanip>
int main()
{
	int n;
	cin >> n;
	double d = 0;
	double maxx = -1;
	double minn = 101;
	for (int i = 1;i <= n;i++)
	{
		double x;
		cin >> x;
		maxx = max(maxx, x);
		minn = min(minn,x);
		d += x;
	}
	cout << maxx << endl;
	cout << minn << endl;
	cout << fixed << setprecision(2) << d / n << endl;
	return 0;
}
cpp 复制代码
#include<iostream>
using namespace std;
#include<string>
int main()
{
	char c1, c2, c3, c4, c5;
	cin >> c1 >> c2 >> c3 >> c4 >> c5;
	string s;
	s.resize(3);
	s[0] = c1;
	s[1] = c2;
	s[2] = c3;
	if (s == "Jan")
	{
		cout << 1;
	}
	else if (s == "Feb")
	{
		cout << 2;
	}
	else if (s == "Mar")
	{
		cout << 3;
	}
	else if (s == "Apr")
	{
		cout << 4;
	}
	else if (s == "May")
	{
		cout << 5;
	}
	else if (s == "Jun")
	{
		cout << 6;
	}
	else if (s == "Jul")
	{
		cout << 7;
	}
	else if (s == "Aug")
	{
		cout << 8;
	}
	else if (s == "Sep")
	{
		cout << 9;
	}
	else if (s == "Oct")
	{
		cout << 10;
	}
	else if (s == "Nov")
	{
		cout << 11;
	}
	else if (s == "Dec")
	{
		cout << 12;
	}
	cout << " ";
	int x = 10 * ((int)(c4 - 48)) + (int)(c5 - 48);
	cout << x;
	return 0;
}
cpp 复制代码
#include<iostream>
using namespace std;
#include<string>
int main()
{
	string str;
	cin >> str;
	for (int i = 0;i < str.length();i++)
	{
		if ((int)(str[i] >= 97))
		{
			cout << char(str[i] - 32);
		}
		else
		{
			cout << str[i];
		}
	}
	return 0;
}
cpp 复制代码
#include<iostream>
using namespace std;
#include<string>
int main()
{
	long long n;
	cin >> n;
	while (n != 0)
	{
		cout << n << " ";
		n /= 2;
	}
	return 0;
}
相关推荐
维构lbs智能定位6 小时前
北斗卫星导航定位从核心框架到定位流程详解(一)
算法·北斗卫星导航定位系统
byzh_rc6 小时前
[算法设计与分析-从入门到入土] 动态规划
算法·动态规划
Halo_tjn6 小时前
Java List集合知识点
java·开发语言·windows·算法·list
云飞云共享云桌面7 小时前
河北某机器人工厂8个研发设计共享一台SolidWorks云主机
运维·服务器·网络·数据库·算法·性能优化·机器人
元亓亓亓7 小时前
LeetCode热题100--152. 乘积最大子数组--中等
算法·leetcode·职场和发展
执笔论英雄7 小时前
【RL】Slime训练流程
算法
梭七y8 小时前
【力扣hot100题】(103)移动零
数据结构·算法·leetcode
weixin_413063218 小时前
测试《A Simple Algorithm for Fitting a Gaussian Function》拟合
python·算法
MarkHD8 小时前
智能体在车联网中的应用:第31天 基于RLlib的多智能体PPO实战:MAPPO算法解决simple_spread合作任务
算法
IT猿手8 小时前
三维动态避障路径规划:基于部落竞争与成员合作算法(CTCM)融合动态窗口法DWA的无人机三维动态避障方法研究,MATLAB代码
算法·matlab·动态规划·无人机·路径规划·动态路径规划