题目描述
blablabla
define _CRT_SECURE_NO_WARNINGS
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
const int N = 11, M = 10;
char s[N];
int a[M], b[M];
int main()
{
scanf(“%s”, s);
a[0] = s[0] - '0';
for (int i = 0; i < 3; i++)
a[i + 1] = s[i + 2] - '0';
for (int i = 0; i < 5; i++)
a[i + 4] = s[i + 6] - '0';
if (s[12] == 'X')
a[9] = 10;
else
a[9] = s[12] - '0';
int chk = 0;
for (int i = 0; i < 9; i++)
chk += a[i] * (i + 1);
chk %= 11;
if (chk == a[9])
cout << "Right";
else if (chk == 10)
{
s[12] = 'X';
cout << s;
}
else
{
s[12] = chk + '0';
cout << s;
}
return 0;
}
样例
blablabla
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla