| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
拿去吧~~随便看~~给那些错的人看看哪儿错了#include "iostream"
using namespace std;
int main()
{
char book[11];
int sum=0,i,k,j=0;
cin>>book;
for(i=0;i<10;i++)
{
if(book[i]!='?')
{
if(book[i]=='X')
book[i]=10+'0';
sum+=(10-i)*(book[i]-'0');
}
else k=i;
}
if(k==9)j=1;
for(i=0;i<=9+j;i++)
if(((10-k)*i+sum)%11==0)break;
if(k==9 && i==10)cout<<"X"<<endl;
else if(i==10)cout<<-1<<endl;
else cout<<i<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator