#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. SPRING 集成 activemq 的 topic 模式

    概要 activemq 支持两种模式: 1.队列模式 2. 发布订阅者模式,topic有一个主题可以有多个订阅者.这种情况可以将一个消息,分发到多个消费者. 比如我有这样一个案例,用户需要同步,而且需 ...

  2. 在vue或者react中使用express框架

    在react 或者 vue项目中使用express框架 1.创建vue或者 react 项目 2.在项目中创建server文件夹,创建server.js //require()方法引入express模 ...

  3. mysql的myBatis,主键自增设置

    方法一: insert id="insert" parameterType="Person" useGeneratedKeys="true" ...

  4. s5-11 距离矢量路由选择协议

    距离矢量路由选择(Distance Vector:DV) 每个路由器维护一张表,表中列出了当前已知的到每个目标 的最佳距离,以及为了到达那个目标,应该从哪个接口转发. 距离矢量路由选择(Distanc ...

  5. svn更新的时候出现ERROR:Previous operation has not finished,run "clean up" if it wa interrupted;进行clean up命令也报错

    报错的截图: 然后进行了clean up命令,依旧报错了: 这种情况就有两种方法去解决了,自己可以根据自己的情况选择,哪种方便选择哪种呗! 方法一: 备份自己修改的文件,删除之前download的文件 ...

  6. vue中文章的折叠于显示全部

    在以一篇文章中,可能文章特别长,但是在页面第一次显示的时候可能就只需要显示一部分,这种情况下就需要自己进行修改 基本思路 利用类名就是预先定义一个类名,设置高度,和overflow:hidden,前提 ...

  7. 微信小程序之跨界面传参

    微信小程序在两个之间传参类似js传递url拼接参数,举个例子来说吧 input自己设置参数 //index.wxml <form bindsubmit="formSubmit" ...

  8. tabindex属性用法

    支持tabindex属性的元素:<a> <input> <textarea> <area> <select> <button> ...

  9. XCode中常用错误解决

    No such file or directory     解决方法(可以依次尝试,总有一种能最终解决问题):          方法1.退出Xcode,然后从finder里面进入~/Library/ ...

  10. Scala_数据结构

    数据结构 容器(Collection) Scala提供了一套丰富的容器(collection)库,包括列表 (List).数组(Array).集合(Set).映射(Map)等 根据容器中元素的组织方式 ...