Codeforces #282 div2 ABC(一)

2015-01-24 05:48:37 · 作者: · 浏览: 13

A. Digital Counter time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output

Malek lives in an apartment block with 100 floors numbered from 0 to 99. The apartment has an elevator with a digital counter showing the floor that the elevator is currently on. The elevator shows each digit of a number with 7 light sticks by turning them on or off. The picture below shows how the elevator shows each digit.

\

One day when Malek wanted to go from floZ??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vciA4OCB0byBmbG9vcgowIHVzaW5nIHRoZSBlbGV2YXRvciBoZSBub3RpY2VkIHRoYXQgdGhlIGNvdW50ZXIgc2hvd3MgbnVtYmVyCjg5IGluc3RlYWQgb2YgODguIFRoZW4gd2hlbiB0aGUgZWxldmF0b3Igc3RhcnRlZCBtb3ZpbmcgdGhlIG51bWJlciBvbiB0aGUgY291bnRlciBjaGFuZ2VkIHRvCjg3LiBBZnRlciBhIGxpdHRsZSB0aGlua2luZyBNYWxlayBjYW1lIHRvIHRoZSBjb25jbHVzaW9uIHRoYXQgdGhlcmUgaXMgb25seSBvbmUgZXhwbGFuYXRpb24gZm9yIHRoaXM6IE9uZSBvZiB0aGUgc3RpY2tzIG9mIHRoZSBjb3VudGVyIHdhcyBicm9rZW4uIExhdGVyIHRoYXQgZGF5IE1hbGVrIHdhcyB0aGlua2luZyBhYm91dCB0aGUgYnJva2VuIHN0aWNrIGFuZCBzdWRkZW5seSBoZSBjYW1lIHVwCiB3aXRoIHRoZSBmb2xsb3dpbmcgcHJvYmxlbS48L3A+CjxwPlN1cHBvc2UgdGhlIGRpZ2l0YWwgY291bnRlciBpcyBzaG93aW5nIG51bWJlciA8ZW0+bjwvZW0+LiBNYWxlayBjYWxscyBhbiBpbnRlZ2VyCjxlbT54PC9lbT4gKDA/odw/PGVtPng8L2VtPj+h3D85OSkKZ29vZCBpZiBpdA=="s possible that the digital counter was supposed to show x but because of some(possibly none) broken sticks it's showing n instead. Malek wants to know number of good integers for a specific n. So you must write a program that calculates this number. Please note that the counter always shows two digits.

Input

The only line of input contains exactly two digits representing number n (0?≤?n?≤?99). Note that n may have a leading zero.

Output

In the only line of the output print the number of good integers.

Sample test(s) Input
89
Output
2
Input
00
Output
4
Input
73
Output
15
Note

In the first sample the counter may be supposed to show 88 or 89.

In the second sample the good integers are 00, 08, 80 and 88.

In the third sample the good integers are 03,?08,?09,?33,?38,?39,?73,?78,?79,?83,?88,?89,?93,?98,?99.


#include 
  
   
#include 
   
     #include 
    
      #include 
     
       #include 
      
        #include 
       
         #define N 1000 #define ll __int64 using namespace std; int vis[20]={2,7,2,3,3,4,2,5,1,2}; //电梯数字显示出现不同程度损坏,可能有一个或几个stick熄灭,算出每个数字存在的情况
       
      
     
    
   
  
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int ans=1;

        int a=n%10;
        int b=n/10;

        ans*=vis[a];
        ans*=vis[b];

        cout<
  
   

B. Modular Equations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output

Last week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define i modulo j as the remainder of division of i by j and denote it by \. A Modular Equation, as Hamed"s teacher described, is an equation of the form \ in which a and b are two non-negative integers and x is a variable. We call a positive integer x for which \ a solution of our equation.

Hamed didn"t pay much attention to the class since he was watching a movie. He only managed to understand the definitions of these equations.

Now he wants to write his math exercises but since he has no idea how to do that, he asked you for help. He has told you all he knows about Modular Equations and asked you to write a program which given two numbers a and b determines how many answers the Modular Equ