标签:sse ret 执行 校验 程序 cpp 文件包含 pass turn
// test4.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "pch.h"
#include <iostream>
#include <cmath>
using namespace std;
int quanz[17] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 };
char s_fz[100][18];
int tran(char a)
{
int k;
for (int i = 0; i <= 10; i++)
{
if (a == ‘0‘ + i)
{
k = i; return k;
}
if (a == ‘X‘)
{
k = 10; return k;
}
}
}
int g, j, k;
int main()
{
k = 0;
cin >> g;
for (int i = 0; i < g; i++)
{
j = 0;
do
{
cin >> s_fz[i][j];
j++;
} while (j != 18);
}
int cl;
int c[100][18];
for (int j = 0; j < g; j++)
{
int k = 0;
for (int i = 0; i <= 17; i++)
{
cl = tran(s_fz[j][i]);
c[j][k] = cl;
k++;
}
}
int sum[100];
int Sum=0;
int k5 = 0;
for (int j = 0; j < g; j++)
{
for (int i = 0; i <= 16; i++)
{
Sum = Sum + c[j][i] * quanz[i];
}sum[k5] = Sum; k5++;
}
int mo[100];
int j1=0;
for (int i = 0; i < g; i++)
{
mo[i] = sum[i] % 11;
if (mo[i] == c[i][17]) { j1++; }
else
{
for (int j = 0; j < 18; j++)
{
cout << s_fz[i][j];
}
}
}
if (j1 == g)
{
cout << "All passed";
}
}
全是BUG,无力吐槽
标签:sse ret 执行 校验 程序 cpp 文件包含 pass turn
原文地址:https://www.cnblogs.com/likeghee/p/9926672.html