咋回事,第一个测试点跟例子1一模一样都能WA?
查看原帖
咋回事,第一个测试点跟例子1一模一样都能WA?
1091218
lingbangfu楼主2024/1/17 12:05
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
	char s[20];
	cin>>s;
	int a=0,n=1;
	for(int i=0;i<12;i++){
		if(s[i]>='0'&&s[i]<='9'){
			a+=(s[i]-'0')*n;
			n++;
		}
	}
	int b=s[12]-'0';
	if(b==a%11){
		cout<<"Right";
	}else{
		b=a%11;
		s[12]=b+'0';
	}
	cout<<s;
	return 0;
} 
2024/1/17 12:05
加载中...