文章
55
粉丝
100
获赞
12
访问
31.1k
#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
map<int, char> myMap;
myMap[0] = '1';
myMap[1] = '0';
myMap[2] = 'X';
myMap[3] = '9';
myMap[4] = '8';
myMap[5] = '7';
myMap[6] = '6';
myMap[7] = '5';
myMap[8] = '4';
myMap[9] = '3';
int arr[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
string str;
while (cin >> str)
{
bool flag = true;
int len = str.length();
if (len == 18)
{
int sum = 0;
for (int i = 0; i < len - 1; i++)
{
sum += (str[i] - '0') * arr[i];
}
int remain = sum % 11;
char jiao = str[17];
if (remain != 10)
{
if (myMap[remain] == jiao)
{...
登录后发布评论
暂无评论,来抢沙发