C. Vanya and Label
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Examples
input
  1. z
output
  1. 3
input
  1. V_V
output
  1. 9
input
  1. Codeforces
output
  1. 130653412
    思路:打表得到并之后的种数;
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll __int64
  4. #define mod 1000000007
  5. #define inf 999999999
  6. #define pi (4*atan(1.0))
  7. const int N=1e2+,M=1e5+;
  8. ll flag[N];
  9. ll getnumber(char a)
  10. {
  11. if(a=='-')
  12. return ;
  13. if(a=='_')
  14. return ;
  15. if(a>=''&&a<='')
  16. return a-'';
  17. if(a>='a'&&a<='z')
  18. return a-'a'+;
  19. if(a>='A'&&a<='Z')
  20. return a-'A'+;
  21. }
  22. char a[];
  23. int main()
  24. {
  25. ll x,y,z,i,t;
  26. for(i=;i<=;i++)
  27. for(t=;t<=;t++)
  28. {
  29. ll gg=(i&t);
  30. if(gg<)
  31. flag[gg]++;
  32. }
  33. scanf("%s",a);
  34. x=strlen(a);
  35. ll ans=;
  36. for(i=;i<x;i++)
  37. {
  38. ans*=flag[getnumber(a[i])];
  39. ans%=mod;
  40. }
  41. printf("%I64d\n",ans);
  42. return ;
  43. }

codeforces 355 div2 C. Vanya and Label 水题的更多相关文章

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

  2. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

  3. codeforces 677A A. Vanya and Fence(水题)

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

  4. codeforces Gym 100187L L. Ministry of Truth 水题

    L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...

  5. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  6. Educational Codeforces Round 14 A. Fashion in Berland 水题

    A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...

  7. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  8. Codeforces Round #190 (Div. 2) 水果俩水题

    后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...

  9. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

随机推荐

  1. 最大网络流(Dinic)

    hdu1532 Drainage Ditches Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  2. (贪心)kruskal思想

    hdu4313 Matrix Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  3. apache+tomcat负载均衡3种实现方式

    1.首先安装apache,编译完成后,通过IP:端口就行访问,如果返回“it workers”证明Apache启动成功(注意apache的工程路径要正确) 2.下载JK,下载地址为http://mir ...

  4. 精通linux设备驱动开发 笔记

      3.2.7 错误处理   #include <linux/err.h> char * collect_data(char *userbuffer) { char *buffer; /* ...

  5. vue - vue

    一.vue - 介绍 vue的作者叫尤雨溪,中国人.自认为很牛逼的人物,也是我的崇拜之神. 关于他本人的认知,希望大家读一下这篇关于他的文章,或许你会对语言,技术,产生浓厚的兴趣.https://mp ...

  6. Key Set---hud5363(快速幂)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5363 #include <iostream> #include <cstdlib&g ...

  7. Miller-Rabin素数测试算法(POJ1811Prime Test)

    题目链接:http://poj.org/problem?id=1811 题目解析:2<=n<2^54,如果n是素数直接输出,否则求N的最小质因数. 求大整数最小质因数的算法没看懂,不打算看 ...

  8. HDU1698:Just a Hook(线段树区域更新模板题)

    http://acm.hdu.edu.cn/showproblem.php?pid=1698 Problem Description In the game of DotA, Pudge’s meat ...

  9. HDU1757:A Simple Math Problem(矩阵快速幂)

    http://acm.hdu.edu.cn/showproblem.php?pid=1757 Problem Description Lele now is thinking about a simp ...

  10. Selenium IDE的一些操作

    1.运行速度过快时,可能出现找不到元素的情况,影响运行结果,将速度调慢慢一些,就可以运行成功. 如果为其他情况找不到元素,则需要另外找原因,有可能元素定位有问题,有可能无该元素. 2.导出录制的脚本为 ...