Vanya and LabelCrawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Submit Status Practice _ uDebug

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

 

Input
  1. z
Output
  1. 3
Input
  1. V_V
Output
  1. 9
Input
  1. Codeforces
Output
  1. 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:

  1. z&_ = 61&63 = 61 = z
  2. _&z = 63&61 = 61 = z
  3. z&z = 61&61 = 61 = z
    1. /*
    2. 有几个0,就有几个三
    3. */
    4. #include <string.h>
    5. #include <iostream>
    6. #include <algorithm>
    7. #include <stdio.h>
    8. #define N 100010
    9. using namespace std;
    10. const int mod =1e9+;
    11. /*void inti()
    12. {
    13. for(int i=0;i<=63;i++)
    14. {
    15. int s=0;
    16. while(i)
    17. {
    18. if(i%2==0) s++;
    19. i/=2;
    20. }
    21. ans[i]=s;
    22. }
    23. }
    24. */
    25. int get(char c)
    26. {
    27. if(c>=''&&c<='')return c-'';
    28. if(c>='A'&&c<='Z')return c-'A'+;
    29. if(c>='a'&&c<='z')return c-'a'+;
    30. if(c=='-')return ;
    31. if(c=='_')return ;
    32. }
    33. int main()
    34. {
    35. //freopen("in.txt","r",stdin);
    36. char ch[N];
    37. long long s=;
    38. scanf("%s",&ch);
    39. for(int i=;ch[i];i++)
    40. {
    41. long long p=get(ch[i]);
    42. for(int j=;j<;j++)
    43. if(!((p>>j)&))
    44. s=s*%mod; //只有三种
    45.  
    46. }
    47. printf("%lld\n",s);
    48. return ;
    49. }

暑假练习赛 006 E Vanya and Label(数学)的更多相关文章

  1. 暑假练习赛 006 A Vanya and Food Processor(模拟)

    Description Vanya smashes potato in a vertical food processor. At each moment of time the height of ...

  2. 暑假练习赛 006 B Bear and Prime 100

    Bear and Prime 100Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB ...

  3. codeforces 677C C. Vanya and Label(组合数学+快速幂)

    题目链接: C. Vanya and Label time limit per test 1 second memory limit per test 256 megabytes input stan ...

  4. Codeforces 677C. Vanya and Label 位操作

    C. Vanya and Label time limit per test:1 second memory limit per test:256 megabytes input:standard i ...

  5. 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 ...

  6. 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 ...

  7. [暴力枚举]Codeforces Vanya and Label

    Vanya and Label time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. jsonp其实很简单【ajax跨域请求】

    js便签笔记(13)——jsonp其实很简单[ajax跨域请求] 前两天被问到ajax跨域如何解决,还真被问住了,光知道有个什么jsonp,迷迷糊糊的没有说上来.抱着有问题必须解决的态度,我看了许多资 ...

  2. 大数据 - Teradata学习体会

    引言 随着计算机系统在处理能力.存储能力等方面,特别是计算机软件技术的不断提高,使得信息处理技术得到飞速发展. 数据处理主要分为两大类:联机事物处理OLTP.联机分析处理OLAP.OLTP也就是传统的 ...

  3. Vue.js的从入门到放弃进击录(一)

    感谢我们项目组给机会,让我学了Vue.js,打开新世界大门...哈哈哈,也没有那么夸张,不过学下来确实觉得入门还是蛮容易的.我大概前前后后学了有一个月的样子,一开始只是比较急着可以写东西出来,后来因为 ...

  4. vue实例讲解之vuex的使用

    vuex是一个状态管理插件,本文通过一个简单的实例来讲解一下,vuex的使用. 先看一张官方的图: 这个图新手一看估计是蒙的,简单解释一下,这个图表示的就是vue通过Action Mutations ...

  5. snmp之GenericAddress

    GenericAddress 注册地址类型,而不是默认的,第一次调用解析(java.lang.String的)方法之前,设置系统属性ADDRESS_TYPES_PROPERTIES. 这个类涉及到了工 ...

  6. http://codeforces.com/contest/535/problem/C

    C. Tavas and Karafs time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  7. UWP 改变Button样式

    -----some words------ 1.Control:控制 (我们理解成控件) 2.Template:模板 3.Ellipse 椭圆 4.Content 内容 5.Presenter 节目主 ...

  8. django celery的分布式异步之路(一) 起步

    如果你看完本文还有兴趣的话,可以看看进阶篇:http://www.cnblogs.com/kangoroo/p/7300433.html 设想你遇到如下场景: 1)高并发 2)请求的执行相当消耗机器资 ...

  9. vb6.0快速操作注册表函数大全(仅字符串KEY值部分)

    Option Explicit '声明要加载的函数 Private Declare Function RegCreateKey Lib "advapi32.dll" Alias & ...

  10. Session详解及集群共享

    Session的介绍 维基百科:会话(session)是一种持久网络协议,在用户(或用户代理)端和服务器端之间创建关联,从而起到交换数据包的作用机制,session在网络协议(例如telnet或FTP ...