洛谷中的习题——手机(P1765)

2024年8月10日 | 分类: 【待理】

//#ifndef coutAIO_H
#include <iostream>//数据类型前面加mutable可以避免常函数中。
#include <windows.h>//Ctrl+K+C一键注释,Ctrl+K+U一键去释  /*																	———								——													——																——														——										——					*/
#include <conio.h>
#include <stack>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iomanip>
#define MAX 1000//最大数字量
using namespace std;
long long sz[10000][10000];//数组,用于分解整数
string str1, str2, str3="";
long long jc(long long a) {//阶乘(!a)
	long long k = 1;
	for (long long i = 0; i < a; i++)
	{
		k*=i;
	}
	return 1;
}
long long zsws(long long a) {//求整数位数
	short b = 0;
	while (a) {
		a /= 10;
		b++;
	}
	return b;
}
void fj(long long a) {//分解整数各位
	long long b = zsws(a), i;
	while (b--) {
		sz[0][b] = a % 10;
		a /= 10;
	}
}
void xycfb(long long x = 9, long long y = 9) {//把xy乘法表存在sz里。
	for (long long i = 0; i < x; i++) {
		for (long long j = 0; j < y; j++) {
			sz[i][j] = (i + 1) * (j + 1);
		}
	}
}
void scsz(long long x = 9, long long y = 9) {//输出数组
	for (int i = 0; i < x; i++) {
		for (int j = 0; j < y; j++) {
			cout << sz[i][j] << "\t";
		}
		cout << endl;
	}
}
void sccfb(long long a = 9, long long b = 9) {//输出ab乘法表
	xycfb(a, b);
	scsz(a, b);
}
long long fbnq(long long a) {//斐波那契数列求和
	if (a > 2)
		return fbnq(a - 1) + fbnq(a - 2);
	return 1;
}
void printsz(char* arr[]) {//打印数组
	long long i = 0;
	for (; *arr != NULL; arr++) {
		cout << i << " " << *arr << endl;//第几个被输出与
		i++;
	}
}
//以上新添
void gotoxy(int y, int x)
{
	COORD  coord;
	coord.X = x;
	coord.Y = y;
	HANDLE a = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(a, coord);
}

bool isprime(long long a) {
	long long l = 0;
	if (a == 2) {
		return true;
	}
	else if (a%2 == 0) {
		return false;
	}
	else {
		for (size_t m = 3; m < a; m+=2)
		{
			if (a % m == 0) {
				return false;
			}
		}
		return a;
	}
}

void color(int a)//打印颜色
{
	/*亮白*/    if (a == 0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	/*蓝色*/    if (a == 1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
	/*绿色*/    if (a == 2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	/*紫色*/    if (a == 3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
	/*红色*/    if (a == 4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	/*黄色*/    if (a == 5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
	/*深蓝色*/    if (a == 6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	/*土黄色or金黄色*/    if (a == 7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
	/*灰色接近白*/    if (a == 8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
void bukaqingping() {
	gotoxy(0, 0);/*
	for (int i = 0; i < 50; i++) {
		cout << "																																																		                                                                                                       " << endl;
	}*/
	system("cls");
	gotoxy(0, 0);
}
template<typename T>
void swap(T & a, T & b) {
	T temp = a;
	a = b;
	b = temp;
}
long long numberaio(char* n) {
	long long i = 0;
	while(true){
		if (n[i] == '\0')
		{
			return i;
		}
		i++;
	}
}
void coutAIO(string b, int truefalse0 = 0, bool truefalse1 = 0) {//说的话,速度,是否回车。
	int i = 0, s = 0;
	long long a = b.size();
	while (a != 0) {
		color(2);
		/*
		s = rand() % 9;
		if (a != 0 && s == 0)
		{
			color(0);
		}
		if (a != 0 && s == 1)
		{
			color(1);
		}
		if (a != 0 && s == 2)
		{
			color(2);
		}
		if (a != 0 && s == 3)
		{
			color(3);
		}
		if (a != 0 && s == 4)
		{
			color(4);
		}
		if (a != 0 && s == 5)
		{
			color(5);
		}
		if (a != 0 && s == 6)
		{
			color(6);
		}
		if (a != 0 && s == 7)
		{
			color(7);
		}
		if (a != 0 && s == 8)
		{
			color(8);
		}*/
		cout << b[i];
		a--;
		i++;

		if (truefalse0 == 1) {
			Sleep(10);
		}
		if (truefalse0 == 2) {
			Sleep(20);
		}
		if (truefalse0 == 3) {
			Sleep(40);
		}
		if (truefalse0 == 4) {
			Sleep(100);
		}
		if (truefalse0 == 5) {
			Sleep(300);
		}
		if (truefalse0 == 6) {
			Sleep(1000);
		}
	}
	if (truefalse1 == 0) {
		cout << endl;
	}
}
constexpr size_t tmp_FNV_offset_basis = 2166136261U;
constexpr size_t tmp_FNV_prime = 16777619U;
size_t hash(string Hash) {//求哈希值
	string str = Hash;
	size_t val = tmp_FNV_offset_basis;
	for (int i = 0; i < str.length(); ++i) {
		val ^= static_cast<size_t>(str[i]);
		val *= tmp_FNV_prime;
	}
	return val;
}
string Hex1, Hex2, strans;
int DecArr[MAX] = { 0 };




void Reverse(char* s ) {//新轮子,翻转字符串
	int n=numberaio(s);
	for (int i = 0, j = n - 1; i < j; i++, j--) {
		char c = s[i];
		s[i] = s[j];
		s[j] = c;
    }
}


int main()
{
	/*FILE* stream;
	freopen_s(&stream,"源.in","r",stdin);
	freopen_s(&stream,"源.out", "w", stdout);*/
	char ch;

	long long ans = 0;
	
	while (cin >> ch, ch != '/') {
		if (ch < 123 && ch >= 97) {

			if (ch % 3 == 1) {
				ans++;
			}
			else if (ch % 3 == 2) {
				ans += 2;
			}
			else{
				ans += 3;
			}
		}
		else {
			ans++;
		}
	}

	cout << ans << endl;
	system("pause");
	bukaqingping();
	
	
	return 0;
}