暑假练习赛 006 E Vanya and Label(数学)
Vanya and LabelCrawling in process... Crawling failed Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u

Description
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 ...
随机推荐
- Finally-操作返回值
Finally中操作返回会出现一个问题?直接看代码 static int M1() { ; try { result = result + ; //======引发异常的代码========== , ...
- js中set和get的用法
get 语句作为函数绑定在对象的属性上,当访问该属性时调用该函数. set 语法可以将一个函数绑定在当前对象的指定属性上,当那个属性被赋值时,你所绑定的函数就会被调用. eg: var log = [ ...
- H264常见术语名称
一.术语 帧(frame)和场(field):一帧包含一个亮度矩阵采样点和俩个对应的色度矩阵采样点,一帧包含俩个场:顶场和底场: 条带:特定条带组按光栅扫描顺序排列的整数个宏块或宏块对: 条带组:图像 ...
- 【原创】流程引擎的网关(遵循BPMN2.0)设计总结
概述 BPMN 2.0是什么呢?业务流程模型注解(Business Process Modeling Notation - BPMN)是 业务流程模型的一种标准图形注解.这个标准 是由对象管理组(Ob ...
- java中的finally用return也挡不住
今晚做了科达的题,有一题就是这个意思,我自以为return中断一切,然而事实摆在眼前:
- CPU工作方式、多核心、超线程技术详解[转贴]
CPU是一台电脑的灵魂,决定电脑整体性能.现在的主流CPU都是多核的,有的运用了多线程技术(Hyper-threading,简称HT).多核可能还容易理解些,相信不少玩家都能说出个所以然.但超线程是个 ...
- 给vue项目添加ESLint
eslint配置方式有两种: 注释配置:使用js注释来直接嵌入ESLint配置信息到一个文件里 配置文件:使用一个js,JSON或者YAML文件来给整个目录和它的子目录指定配置信息.这些配置可以写在一 ...
- GRE 协议简介
1. 协议简介 gre(generic routing encapsulation,通用路由封装)协议是对某些网络层协议(如ip 和ipx)的数据报进行封装,使这些被封装的数据报能够在另一个网络 ...
- c# 反射得到实体类的字段名称和值,DataTable转List<T>
/// <summary> /// 反射得到实体类的字段名称和值 /// var dict = GetProperties(model); /// </summary> /// ...
- 张高兴的 Windows 10 IoT 开发笔记:RTC 时钟模块 DS3231
GitHub:https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/DS3231 注意:不包含闹钟设置