题解 | #[NOIP2008]ISBN号码#
[NOIP2008]ISBN号码
https://www.nowcoder.com/practice/95712f695f27434b9703394c98b78ee5
#include <iostream> using namespace std; int main() { int a, b,c,d; int sb=0; cin>>a;cin.ignore(); cin>>b;cin.ignore(); cin>>c;cin.ignore(); cin>>d;cin.ignore(); sb = ((a*1 )+(b/10%10)*3+(b/100)*2+(b%10)*4+(c/10000)*5+((c/1000)%10) *6+((c/100)%10) *7+((c/10)%10) *8+(c%10) *9)%11; //cout << sb; if(sb == d||d ==0 && sb == 10){ cout << "Right"<<endl; } else if(sb == 10){ b= -b,c= -c; cout<<a<<b<<c<<"-X"<<endl; } else{ b= -b,c= -c,d=-sb; cout<<a<<b<<c<<d<<endl; } } // 64 位输出请用 printf("%lld")