C++蒟蒻求助!!才70分!!在线等,急!!
查看原帖
C++蒟蒻求助!!才70分!!在线等,急!!
791174
Hans4103423楼主2022/9/13 20:34

代码↓

#include <bits/stdc++.h>
using namespace std;
string s,mod = "0123456789X";
int a,j = 1;
int main(){
	cin>>s;
	for(int i = 0 ; i < 12 ; i ++){
		if(s[i] == '-'){
			continue;
		}
		a += (s[i] - '0') * j;
		j ++;
	}
	if(s[12] == mod[a % 11]){
		cout<<"Right";
	}
	else{
		s[12] = mod[a % 11];
		cout<<s;
	}
}
2022/9/13 20:34
加载中...