第二期训练题白银组:06

点击查看原题
在这里插入图片描述
ac的c++代码如下:

#include <iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	char *c = new char[n];
	int *p = new int[n];
	int *u = new int[n];
	for (int i = 0; i < n; i++)
	{
		cin >> c[i] >> p[i];
		if (c[i] >= 65 && c[i] <= 90)
			u[i] = (int)c[i] - 64;
		else if (c[i] >= 97 && c[i] <= 122)
		{
			c[i] = c[i] - 32;
			u[i] = ((int)c[i] - 64)*(-1);
		}
	}
	for (int i = 0; i < n; i++)
	{
		cout << u[i] + p[i] << endl;
	}
	delete c, p, u;
	return 0;
}

猜你喜欢

转载自blog.csdn.net/Go_Joe/article/details/84961682