tech1540 @ 2024-08-25 22:37:21
#include<bits/stdc++.h>
using namespace std;
int q,w,e,r,t,y,u,i,o,sum,p1;
char p;
int main()
{
cin>>q>>"-">>w>>e>>r>>"-">>t>>y>>u>>i>>o>>"-">>p;
if(p=='X')p1=10;
else p1=p;
sum=q*1+w*2+e*3+r*4+t*5+y*6+u*7+i*8+o*9;
if(p1==sum%11)printf("Right");
else if(sum%11==10&&p1!=10)cout<<q<<"-"<<w<<e<<r<<"-"<<t<<y<<u<<i<<o<<"-"<<"X";
else cout<<q<<"-"<<w<<e<<r<<"-"<<t<<y<<u<<i<<o<<"-"<<sum%11;
return 0;
}
这个为啥还会ce啊qwq
by scratch_szc @ 2024-08-25 22:39:33
#include<bits/stdc++.h>
using namespace std;
int q,w,e,r,t,y,u,i,o,sum,p1;
char p;
int main()
{
cin>>q>>w>>e>>r>>t>>y>>u>>i>>o>>p;
if(p=='X')p1=10;
else p1=p;
sum=q*1+w*2+e*3+r*4+t*5+y*6+u*7+i*8+o*9;
if(p1==sum%11)printf("Right");
else if(sum%11==10&&p1!=10)cout<<q<<"-"<<w<<e<<r<<"-"<<t<<y<<u<<i<<o<<"-"<<"X";
else cout<<q<<"-"<<w<<e<<r<<"-"<<t<<y<<u<<i<<o<<"-"<<sum%11;
return 0;
}
by scratch_szc @ 2024-08-25 22:40:18
@tech1540
by cosf @ 2024-08-25 22:50:03
了解一下(省略号当然要换):
char q, w, ..., p;
scanf("%c-%c%c%c-%c%c%c%c%c-%c", &q, &w, ..., &p);
by llhhss @ 2024-09-04 20:13:48
#include <iostream>
#include <cstring>//头文件不解释
using namespace std;
int main()
{
char s[14],c;
cin>>s;
int h=0,k=0;
for(int i=0;i<11;i++)
{
if(s[i]!='-')
{
k++;
h+=k*(s[i]-'0');//-0是为了将字符串变成普通数字
}
}
h%=11;
if(h==10) c='X';
else c=h+'0';
if(c==s[12]) cout<<"Right"<<endl;
else
{
s[12]=c;
cout<<s;
}
return 0;
}