POJ 2498
#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的更多相关文章
- poj 2498 动态规划
思路:简单动态规划 #include<map> #include<set> #include<cmath> #include<queue> #inclu ...
- POJ 2498 Martian Mining
Martian Mining Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2194 Accepted: 1326 De ...
- poj 并查集
http://poj.org/problem?id=1611 水题 题意:就是找一共有多少个人感染了,0是感染学生的编号. #include <stdio.h> #include < ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
随机推荐
- 注解Demo
1.创建注解类 2.在测试实体类中使用注解 3.构建注解解析类 4.执行注解解析方法
- Win7 VS2013环境编译CGAL-4.7
看到有人在QQ空间感叹编译CGAL配置折腾了一天时间,自己也想试试,虽然并不打算用,但感觉这库也挺有名的,想必日后用得着,于是着手试着编译. 首先是看一下官网的windows下配置说明 http:// ...
- GAME PROGRAMM
SetConsoleTextAttribute consolehwnd = GetStdHandle(STD_OUTPUT_HANDLE); GetStdHandle(nStdHandle)//是返回 ...
- README.md 编写
Spring Boot Demo =========================== 该文件用来测试和展示书写README的各种markdown语法.GitHub的markdown语法在标准的ma ...
- ThinkPHP5 <= 5.0.22 远程代码执行高危漏洞
漏洞描述 由于ThinkPHP5框架对控制器名没有进行足够的安全检测,导致在没有开启强制路由的情况下,黑客构造特定的请求,可直接GetWebShell. 漏洞评级 严重 影响版本 ThinkPHP 5 ...
- AngularJS实战之cookie的读取
<!DOCTYPE html> <html ng-controller="cookies_controller"> <head> <tit ...
- ckeditor粘贴上传图片
公司做的项目需要用到文本上传功能. 网上找了很久,大部分都有一些不成熟的问题,皇天不负有心人终于让我找到了一个成熟的项目. 接下来就看一下吧 1.打开工程: 对于文档的上传我们需要知道这个项目的逻辑是 ...
- ★ prototype、__proto__ 详解
# var Person = function(name) { this.name = name; } var p = new Person(); //new操作符的操作是 var p = {} p. ...
- AFNetworking网络请求数据
//创建AFNetworking的请求操作 AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWit ...
- 关于python logging的 NOTSET 级别
说重点: NOTSET 意指不设置 所以按照父logger级别来过滤日志 注意 不是最低级别的意思 由于logging中root日志对象的默认级别是WARNING, 所以当你使用logging.get ...