Codeforces Round #355 (Div. 2) Vanya and Label

Source: Internet
Author: User

This problem is very focused on transformation, the essence is actually the string of each character converted to the corresponding number, according to 6 bits of the binary conversion, and then statistics 0 occurrences of the number of times, 0&1=0,1&0=1,0&0=0, some people use a fast power, in fact, it is completely unnecessary, But be sure to use a long long.

#include  <iostream> #include  <cstdio> #include  <string>using namespace Std;const long Long mod=1e9+7;string s;int getnum (char ch) {if (ch>= ' 0 ' &&ch<= ' 9 ') return ch-' 0 '; if (ch>= ' A ' && Ch<= ' z ') return ch-' a ' +10;if (ch>= ' a ' &&ch<= ' Z ') return ch-' a ' +36;if (ch== '-') return 62;if (ch= ' _ ') return 63;} Long Long Ans=1;int main () {cin>>s;for (int i=0;i<s.size (); i++) {int tag=getnum (s[i]); int cnt=0;for (int j=0;j <6;j++) {if (!) ( tag&1)) Cnt++;tag>>=1;} for (int i=1;i<=cnt;i++) Ans=ans*3%mod;} printf ("%i64d\n", ans); return 0;}

  

Codeforces Round #355 (Div. 2) Vanya and Label

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.