#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. set集合遍历

    对 set 的遍历 1.迭代遍历: Set<String> set = new HashSet<String>(); Iterator<String> it = s ...

  2. hdu6351 2018 Multi-University Training Contest 5 1002 Beautiful Now

    题意: 给出一个十进制数,数位两两可以交换,给出最多能交换多少次,以及交换后的数不能有前缀0,问能形成最小和最大的数 * * * 尝试的思路 贪心,将字符串先排出最大以及最小的情况,然后按一定顺序将对 ...

  3. Ubuntu 16.04 搭建LAMP服务器环境流程

    http://www.linuxidc.com/Linux/2016-09/135629.htm [安装mysql时 只需安装 mysql-server无需安装mysql-client] mysql ...

  4. WebVTT 及 HTML5 <track> 元素简介

    https://dev.opera.com/articles/zh-cn/an-introduction-to-webvtt-and-track/ 简介 网络视频文本轨道,简称为 WebVTT, 是一 ...

  5. python,函数

    numpy.tile():参考https://www.jianshu.com/p/4b74a367833c numpy.argsort:argsort()里面传入参数只有数组时,返回的是数组值从小到大 ...

  6. new命令简化的内部流程

    构造函数返回对象的一些问题: function fn(name,age){ this.name = name; this.age = age; //return 23; 忽略数字,直接返回原有对象 / ...

  7. (转)Log4Net 全方位跟踪程序运行

    转自:http://www.cnblogs.com/qingyuan/archive/2011/05/13/2045616.html 前端日子自己写了一个简单的日志跟踪程序,现在目前正在做的一个项目中 ...

  8. day28(ajax之js原生代码实现)

    ajax ajax:异步页面无刷新技术 AJAX:异步的 JavaScript And XML. * 使用的是老的技术,用的是新的思想. AJAX的功能:完成页面的局部刷新,不中断用户的体验. XML ...

  9. Codeforces Round #265 (Div. 2) D. Restore Cube 立方体判断

    http://codeforces.com/contest/465/problem/D 给定8个点坐标,对于每个点来说,可以随意交换x,y,z坐标的数值.问说8个点是否可以组成立方体. 暴力枚举即可, ...

  10. hdu 5050 大数

    http://acm.hdu.edu.cn/showproblem.php?pid=5050 大数模板最大公约数 信kuangbin,能AC #include <cstdio> #incl ...