Codeforces gym 101047l putting plates on the tuk-tuks quick power

Source: Internet
Author: User
Putting plates on the tuk-tuks Time limit:2000 ms Memory limit:65536kb 64bit Io format:% I64d & % i64ugym 101047l

Description

Standard Input/Output

The tuk-tuk (????), Also known as "auto rickshaw," is a popular form of transportation in Thailand. in order to distinguish tuk-tuks from the other types of vehicles, the Phuket Administration decided to create a new license plate system for them. phuket's tuk-tuk fleet has been growing rapidly, mostly due to tourism, one of the most important economic mic activities in the province. the administration plans the new system to meet the demand for distinct license plates for the next 42 years.

A license plate system is defined by two numbers,CAndD. A license plate in this system is a string formedCConsonants followedDDigits. A license plate cannot be empty (no consonant and no digit ).

In the thai alphabet there are 44 consonants and 10 digits. however, since the symbols of some consonants are too much alike, the Administration decided to use only 26 consonants, whose symbols were considered sufficiently distinguishable.

To guarantee an appropriate supply of tuk-tuks for the contestants in the ICPC World Finals in 2016, phuket's administration wocould like to know the number of distinct license plates it is possible to generate with a given license plate system.

Input

The first line has a single integerT, The number of test cases.

Each test case consists of a single line containing two integersCAndD, The number of consonants and digits, respectively, in a license plate system.

Limits

  • 1 bytes ≤ bytesTLimit ≤ Limit 20
  • 0 bytes ≤ bytesCLimit ≤ limit 6
  • 0 bytes ≤ bytesDLimit ≤ limit 9

Output

For each test case, print a line with the amount of distinct license plates that can be generated by the corresponding system. The answer is guaranteed to be smaller than 231.

Sample Input

Input
3
0 6
2 4
0 0
Output
1000000
6760000
0


Set template speed
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <queue>#include <vector>#include <iomanip>#include <math.h>#include <map>using namespace std;#define FIN     freopen("input.txt","r",stdin);#define FOUT    freopen("output.txt","w",stdout);#define INF     0x3f3f3f3f#define INFLL   0x3f3f3f3f3f3f3f#define lson    l,m,rt<<1#define rson    m+1,r,rt<<1|1typedef long long LL;typedef pair<int,int> PII;const double PI = acos(-1);LL fastpow(LL a,LL b,LL c){    LL res = a;    while(c){        if(c & 1) res = (res * b);        b = (b * b);        c >>= 1;    }    return res;}int main(){    //FIN    int T;    scanf("%d", &T);    while(T--){        LL a, b;        scanf("%I64d%I64d", &a, &b);        LL ans = 1;        ans = fastpow(1, 26, a) * fastpow(1, 10, b);        if(a == b && a == 0)  ans = 0;        printf("%I64d\n", ans);    }}

  

Codeforces gym 101047l putting plates on the tuk-tuks quick power

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.