noip2008复赛ISDN码 c语言

程序
2024-12-22 00:33:20
推荐回答(1个)
回答1:

#include
#include
using namespace std;
ifstream fin ("isbn.in");
ofstream fout ("isbn.out");
string yuan;
int main ()
{int i,len,temp,sum;
fin>>yuan;
sum=0;
temp=1;
len=yuan.size();
for(i=0;i if(yuan[i]>='0'&&yuan[i]<='9')
{sum+=(yuan[i]-'0')*temp;
temp++;
}
sum%=11;
if(yuan[len-1]-'0'==sum)
fout<<"Right"< else
if(sum==10&&yuan[len-1]=='X')
fout<<"Right"< else
{for(i=0;i fout< if(sum==10)
fout<<'X'< else
fout< }
return 0;
}