#include <stdio.h>
#include <stdlib.h> int main()
{
char arr[];
int index,sum=,i;
scanf("%s",arr);
for(i=;i<;i++)
{
if(arr[i]=='?')
{
index=-i;
continue;
}
if(arr[i]=='X')
{
sum+=;
continue;
}
sum+=((-i)*(arr[i]-''));
}
//将串中除了?之外的和求出来,并且记录下?对应的乘数
if(index == )//表明最后一个元素是?,其取值可以是0~10
{
int tmp;
for(i=;i<=;i++)
{
tmp=sum+index*i;
if(tmp%==)
break;
}
if(i==)
putchar('X');
else if(i==)
printf("-1\n");
else
printf("%d\n",i);
}
else//表明?号在前面9位,i只能取到0~9
{
int tmp;
for(i=;i<=;i++)
{
tmp=sum+i*index;
if(tmp % == )
break;
}
if(i==)
printf("-1\n");
else
printf("%d\n",i);
}
return ;
}

poj2190的更多相关文章

随机推荐

  1. jquerymobile listview 局部刷新

    function onSuccess(data, status) { data = $.trim(data); // alert(data); // return; if (data) { $('#l ...

  2. Generator & yield write in sync way

    Generator & yield write in sync way var p = new Promise(function(resolve, reject){ setTimeout(fu ...

  3. Method "setAge" failed for object action.RegistAction@1f05562b [java.lang.No....

    大家好,如果大家看到了这篇文字.我觉得大家应该是遇到了该类问题. 首先,NullPointerException 空指针异常. 其次,大家应该是是在使用struts2和hibernate的使用遇到的这 ...

  4. Oracle EBS-SQL (WIP-10):检查车间任务状态“完成”但未发料数据.sql

    select WE.WIP_ENTITY_NAME                                               任务号,         MFG_LOOKUPS_WJS ...

  5. PHP5中__call、__get、__set、__clone、__sleep、__wakeup的用法

    __construct(),__destruct(),__call(),__callStatic(),__get(),__set(),__isset(),__unset(),__sleep(),__w ...

  6. IOS研究院之打开照相机与本地相册选择图片

    如下图所示 在本地相册中选择一张图片后,我们将他拷贝至沙盒当中,在客户端中将它的缩略图放在按钮旁边,这个结构其实和新浪微薄中选择图片后的效果一样.最终点击发送将按钮将图片2进制图片上传服务器. 下面我 ...

  7. [Leetcode][Python]40: Combination Sum II

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com' 40: Combination Sum IIhttps://oj.leetco ...

  8. 【COM学习】之二、HRESULT,GUID

    HRESULT 来向用户报告各种情况.   他的值位于  WINERROR.H中 QueryInterface返回一个HRESULT值. HRESULT不是一个句柄,他是一个可分成三个域的32位值. ...

  9. Struts 2.3.4.1完整示例

    [系统环境]Windows 7 Ultimate 64 Bit [开发环境]JDK1.6.21,Tomcat6.0.35,MyEclipse10 [其他环境]Struts2.3.4.1 [项目描述]S ...

  10. Item with the same id "98" already exist

    在magento项目中多次遇到这样一个错误: Item (Bluecom_Onefieldusername_Model_Customer) with the same id "98" ...