#include<iostream>
using namespace std;
#include<string>
#include<stdio.h>
int main()
{
//freopen("1.txt","r",stdin);
int i;
int num;
int a[] = { , ,};
string s ;
cin>>num;
int k=;
while(num--){
k++;
cin>>s;
int len;
int mark;
len = s.length();
int sum = ;
for(i = ; i <len ; i++)
if(s[len - - i] != '?')
sum += a[(i)%]*(s[len--i] - '');
else
mark = len - - i;
i = ;
//cout<<mark<<endl;
while(sum++% != || i%a[(len--mark)%]!= )
{
i++;
}; cout<<"Scenario #"<<k<<":"<<endl;
//i+=20;
//cout<<i<<endl;
// cout<<mark<<endl;
for(int j = ; j < len;j ++)
{ if(j != mark)
cout<<s[j];
else
cout<<i/a[(len--mark)%];
}
cout<<endl<<endl;
// cout<<a[(len-1-mark)%3]<<"00000000000"<<endl;
//cout<<i/a[i%3]<<endl;
} }

POJ 2498的更多相关文章

  1. poj 2498 动态规划

    思路:简单动态规划 #include<map> #include<set> #include<cmath> #include<queue> #inclu ...

  2. POJ 2498 Martian Mining

    Martian Mining Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 2194   Accepted: 1326 De ...

  3. poj 并查集

    http://poj.org/problem?id=1611 水题 题意:就是找一共有多少个人感染了,0是感染学生的编号. #include <stdio.h> #include < ...

  4. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  5. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  6. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  7. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  8. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  9. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

随机推荐

  1. 2018.11.01 NOIP训练 木棒分组(搜索+剪枝)

    传送门 测试搜索的时候状态定义错了233. 我们把木棒从大到小排序. 然后保证每一组搜到的木棒出现的长度是从大到小递减的. 直接定义现在搜的木棒从什么位置开始,当前这一组的总长度,之前几组的总长度. ...

  2. android studio友盟分享demo运行报错Gradle's dependency cache may be corrupt解决方法

    gradle-wrapper.properties里修改了gradle的版本,与之前没有报错的项目gradle版本一致.

  3. related work

    Traditional approaches, e.g., genetic algorithm (GA) [2] and ant colony optimization (ACO) [3], can ...

  4. oracle在exp导出时报错PLS-00201: identifier 'EXFSYS.DBMS_EXPFIL_DEPASEXP' must be declared

    报错如下信息: EXP-00008: ORACLE error 6550 encounteredORA-06550: line 1, column 14:PLS-00201: identifier ' ...

  5. Linux主机名域名修改问题

    1.修改 /etc/sysconfig/network  配置文件 vi  /etc/sysconfig/network 修改HOSTNAMEHOSTNAME=new-hostname.domainn ...

  6. c# 动态数组-----“动态”数组

    其实在大多数工作中我们能通过前处理来确定我们的数组有多大,这样我们就可以声明相应大小的数组了.我感觉这种“动态”数组就够我用了.比如我要处理excel中数据,数据有m行*n列,这样我就可以通过读取ex ...

  7. 主机网络ping: unknown host baidu.com问题解决

    本机环境: 系统:Centos 网络:NAT 虚拟机之前一直都可以连外网,但最近不能连了,现状如下: [root@vhost03 ~]# ping baidu.comping: unknown hos ...

  8. Android: Custom View和include标签的区别

    Custom View, 使用的时候是这样的: <com.example.home.alltest.view.MyCustomView android:id="@+id/customV ...

  9. 为WinEdt自定义XeLatex快捷键

    没有彻底抛弃Windows很重要的一方面原因,WinEdt + Sumatra PDF对LaTeX支持的太好了(自动补全,反向搜索),而且当遇到复杂公式的时候,mathtype也能帮上大忙. 我一直用 ...

  10. 找不到UserDetails.java

    真是一个奇葩的问题,dubbo接口 在controller中引用是可以正常的,但是放到service层中,就一直报找不到UserDetails.java,从路径看,看不出来是什么包里面的类 结果把路径 ...