#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. 更新源pip

    国内镜像源列表 豆瓣(douban) http://pypi.douban.com/simple/清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/阿里云 h ...

  2. windows下 python2 和python3 共存

    目前我们在国内网站上看到的两者共存的方法就是将其中一个的python.exe重命名.虽说在一定程度上可行,但存在一个重大的隐患,就是修改了名字的那个python对应的pip将无法使用. 下面说一下具体 ...

  3. 清理docker大日志文件

    1.进入容器文件的存放目录 ,并查看某一个容器的文件大小 [root@auto ~]# [root@auto ~]# cd /var/lib/docker/containers [root@auto ...

  4. telegraph.conf配置

    原文:http://www.cnblogs.com/smail-bao/p/7002361.html 1.操作系统基础监控指标配置标准 基础监控使用通用的全局配置文件telegraf.conf,以下只 ...

  5. @RequestBody jackson解析复杂的传入值的一个坑;jackson解析迭代数组;jackson多重数组;jakson数组

    一.实际开发的一个问题. 传入一个json数组,数组中还嵌套数组,运用springboot+Jpa框架,@RequestBody注解传入数据 Controller @ApiOperation(valu ...

  6. JS、JSP、ASP、CGI

      1)JS是在客户端执行的,需要浏览器支持Javascript.JSP是在服务器端执行的,需要服务器上部署支持Servlet的服务器程序.JS代码是能够直接从服务器上download得到,对外是可见 ...

  7. 工作总结(一):Linux C

    这三个月以来一直忙着赶进度,没有停下来记录一些东西,很多很好的东西往往只能零零散散地记在草稿本上, 这样偶尔想起来自己都找不到,所以现在抽空总结下来. 这些天做了三件事,其一是在Linux下开发了对接 ...

  8. ID、句柄、指针、对象互相转换

    /*************************************************************************************************** ...

  9. POJ1064--Cable master(Binary Search)

    Description Inhabitants of the Wonderland have decided to hold a regional programming contest. The J ...

  10. PAT甲级 1128. N Queens Puzzle (20)

    1128. N Queens Puzzle (20) 时间限制 300 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The & ...