UVA_333_Recognizing Good ISBNs

#include<iostream>    
#include<sstream>    
#include<string>    
#include<vector>    
#include<list>    
#include<set>    
#include<map>    
#include<stack>    
#include<queue>    
#include<algorithm>  
#include<bitset>
#pragma warning(disable:4996)    
using std::cin;
using std::cout;
using std::endl;
using std::stringstream;
using std::string;
using std::vector;
using std::list;
using std::pair;
using std::set;
using std::multiset;
using std::map;
using std::multimap;
using std::stack;
using std::queue;
using std::priority_queue;
using std::bitset;
bool check(const string &ISBN)
{
	vector<int>digit;
	for (size_t i = 0; i < ISBN.size(); i++)
	{
		if (isdigit(ISBN[i]))
		{
			digit.push_back(ISBN[i] - '0');
		}
		else if (ISBN[i] == 'X')
		{
			digit.push_back(10);
			if (digit.size() != 10)
			{
				return false;
			}
		}
	}
	if (digit.size() != 10)
	{
		return false;
	}
	for (size_t i = 1; i < digit.size(); i++)
	{
		digit[i] += digit[i - 1];
	}
	for (size_t i = 1; i < digit.size(); i++)
	{
		digit[i] += digit[i - 1];
	}
	if (digit.size()==10&& digit[9] % 11 == 0)
	{
		return true;
	}
	return false;
}
string clear_space(const string &str)
{
	string ret=str;
	while (ret[0] == ' ')
	{
		ret.assign(ret.begin() + 1, ret.end());
	}
	while (ret[ret.size() - 1] == ' ')
	{
		ret.pop_back();
	}
	return ret;
}
int main()
{
	//freopen("input.txt", "r", stdin);    
	//freopen("output.txt", "w", stdout);
	string ISBN;
	while (getline(cin,ISBN))
	{
		if (!ISBN.size())
		{
			cout << " is incorrect." << endl;
			continue;
		}
		ISBN = clear_space(ISBN);
		cout << ISBN;
		if (check(ISBN))
		{
			cout << " is correct."<<endl;
		}
		else
		{
			cout << " is incorrect." << endl;
		}
	}
	return 0;
}

### MIPI DSI DCS Read Implementation and Documentation In the context of implementing a read operation using MIPI DSI's Display Command Set (DCS), it is essential to configure the system correctly before initiating any data retrieval operations. For reading multiple bytes from a display device via DCS commands, one must first set up the maximum packet size that can be returned by executing `MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE` with an appropriate value such as 0x37 or another suitable byte count depending on requirements[^1]. After setting this parameter, developers should proceed according to their specific application needs while ensuring compliance with both hardware limitations and software protocol specifications outlined within relevant technical documents provided by manufacturers. For practical implementation examples, consider reviewing open-source projects like Linux kernel drivers where similar functionalities are implemented: ```c // Example C code snippet showing how to perform DCS reads in Linux driver static int mipi_dsi_dcs_read(struct spi_device *spi, u8 command) { struct mipi_dsi_host *host; unsigned char buf[2]; host = spi->controller_data; /* Prepare buffer */ buf[0] = command; // Insert your desired DCS command here return mipi_dsi_generic_read(host, &buf, sizeof(buf)); } ``` This function demonstrates sending a single-byte DCS command followed by receiving two bytes back from the connected display panel over SPI interface which could also apply similarly when working directly through MIPI DSI interfaces after proper initialization has been done beforehand. Additionally, exploring resources related to FPGA implementations may provide valuable insights into handling low-level details involved during communication between devices supporting these standards since FPGAs play significant roles not only in achieving high-speed but also reliable connections required for modern displays operating under stringent timing constraints imposed by protocols like those defined in MIPI Alliance specifications[^2][^3]. Furthermore, understanding physical layer aspects including signal integrity considerations at electrical level becomes crucial especially concerning interoperability among various components used across different platforms adhering closely enough so they work seamlessly together without causing issues due to mismatched configurations or improper settings applied incorrectly elsewhere along the chain connecting all parts involved in establishing successful communications channels based upon standardized methods established by organizations responsible for maintaining industry-wide compatibility guidelines covering areas ranging from basic principles down towards more advanced topics involving complex interactions occurring throughout entire systems built around them[^4]. Lastly, recognizing differences between DCS mode versus standard DSI operational modes helps clarify what capabilities certain screens might offer beyond just typical usage scenarios allowing developers greater flexibility when designing applications targeting diverse sets of hardware potentially offering extended functionality unavailable otherwise unless explicitly supported per individual model specifications given by respective vendors supplying panels meeting particular criteria necessary for enabling additional features outside normal expectations associated primarily with mainstream products available today[^5].
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值