暑假练习赛 006 E Vanya and Label(数学)
Vanya and LabelCrawling in process... Crawling failed Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
uDebugDescription
Input
Output
Sample Input
Sample Output
Hint
Description
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bitwise AND is equal to s. As this number can be large, output it modulo 109 + 7.
To represent the string as a number in numeral system with base 64 Vanya uses the following rules:
- digits from '0' to '9' correspond to integers from 0 to 9;
- letters from 'A' to 'Z' correspond to integers from 10 to 35;
- letters from 'a' to 'z' correspond to integers from 36 to 61;
- letter '-' correspond to integer 62;
- letter '_' correspond to integer 63.
Input
The only line of the input contains a single word s (1 ≤ |s| ≤ 100 000), consisting of digits, lowercase and uppercase English letters, characters '-' and '_'.
Output
Print a single integer — the number of possible pairs of words, such that their bitwise AND is equal to string s modulo 109 + 7.
Sample Input
z
3
V_V
9
Codeforces
130653412
Sample Output
Hint
For a detailed definition of bitwise AND we recommend to take a look in the corresponding article in Wikipedia.
In the first sample, there are 3 possible solutions:
- z&_ = 61&63 = 61 = z
- _&z = 63&61 = 61 = z
- z&z = 61&61 = 61 = z
/*
有几个0,就有几个三
*/
#include <string.h>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#define N 100010
using namespace std;
const int mod =1e9+;
/*void inti()
{
for(int i=0;i<=63;i++)
{
int s=0;
while(i)
{
if(i%2==0) s++;
i/=2;
}
ans[i]=s;
}
}
*/
int get(char c)
{
if(c>=''&&c<='')return c-'';
if(c>='A'&&c<='Z')return c-'A'+;
if(c>='a'&&c<='z')return c-'a'+;
if(c=='-')return ;
if(c=='_')return ;
}
int main()
{
//freopen("in.txt","r",stdin);
char ch[N];
long long s=;
scanf("%s",&ch);
for(int i=;ch[i];i++)
{
long long p=get(ch[i]);
for(int j=;j<;j++)
if(!((p>>j)&))
s=s*%mod; //只有三种 }
printf("%lld\n",s);
return ;
}
暑假练习赛 006 E Vanya and Label(数学)的更多相关文章
- 暑假练习赛 006 A Vanya and Food Processor(模拟)
Description Vanya smashes potato in a vertical food processor. At each moment of time the height of ...
- 暑假练习赛 006 B Bear and Prime 100
Bear and Prime 100Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:262144KB ...
- codeforces 677C C. Vanya and Label(组合数学+快速幂)
题目链接: C. Vanya and Label time limit per test 1 second memory limit per test 256 megabytes input stan ...
- Codeforces 677C. Vanya and Label 位操作
C. Vanya and Label time limit per test:1 second memory limit per test:256 megabytes input:standard i ...
- Codeforces Round #355 (Div. 2) C. Vanya and Label 水题
C. Vanya and Label 题目连接: http://www.codeforces.com/contest/677/problem/C Description While walking d ...
- codeforces 355 div2 C. Vanya and Label 水题
C. Vanya and Label time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- [暴力枚举]Codeforces Vanya and Label
Vanya and Label time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #308 (Div. 2)B. Vanya and Books 数学
B. Vanya and Books Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/pr ...
- Codeforces Round #280 (Div. 2) E. Vanya and Field 数学
E. Vanya and Field Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/492/pr ...
随机推荐
- XML(二)之DTD——XML文件约束
前面介绍了XML的作用和基本的格式,今天我给大家分享的是关于XML的约束.废话不多说,我们直接来正题! 一.DTD简介 1.1.DTD概述 DTD(Document Type Definition,文 ...
- spring实例化dataSource使用jndi和jdbc两种方式
一.使用jndi的方式 这种方式方便测试人员不需要改代码,直接改变tomcat的server.xml就可以更改数据库连接 spring创建bean <bean id="dataSour ...
- MyCAT-EYE开源
MyCAT EYE MySQL数据库监控工具,实现了对MySQL节点的管理和监控,可供开发人员和DBA使用.后续版本将整合MyCAT2.0的管理和配置. 演示地址: 开发人员视图:http://120 ...
- 使用LayUI操作数据表格
接着 上一篇 继续完善我们的demo,这次我们加一个搜索按钮 搜索 在table标签的上方,加入这样一组html <div class="demoTable"> 搜索商 ...
- 基于SSM之Mybatis接口实现增删改查(CRUD)功能
国庆已过,要安心的学习了. SSM框架以前做过基本的了解,相比于ssh它更为优秀. 现基于JAVA应用程序用Mybatis接口简单的实现CRUD功能: 基本结构: (PS:其实这个就是用的Mapper ...
- 应试记录2(没有转载标注,NOIP2016复赛过后自动删除)
#include<stdio.h> #include<string.h> int main() { ]; memset(a, , sizeof(a)); ;i<=;i++ ...
- python之HTMLParser解析HTML文档
HTMLParser是Python自带的模块,使用简单,能够很容易的实现HTML文件的分析.本文主要简单讲一下HTMLParser的用法. 使用时需要定义一个从类HTMLParser继承的类,重定义函 ...
- ZOJ 1489 HDU1395 2^x mod n = 1 数学
2^x mod n = 1 Time Limit: 2 Seconds Memory Limit:65536 KB Give a number n, find the minimum x t ...
- RabbitMQ与AMQP协议
AMQP(Advanced Message Queuing Protocol, 高级消息队列协议)是一个提供统一消息服务的应用层标准高级消息队列协议,是应用层协议的一个开放标准,为面向消息的中间件设计 ...
- cocos2dx - 伤害实现
接上一节内容:cocos2dx - 生成怪物及AI 本节主要讲如何通过创建简单的矩形区域来造成伤害 在小游戏中简单的碰撞需求应用box2d等引擎会显得过于臃肿复杂,且功能不是根据需求定制,还要封装,为 ...