Codeforces #495A # Digital Counter

Source: Internet
Author: User
Tags time limit

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

Malek lives in a apartment block with the floors numbered from 0 to 99. The elevator with a digital counter showing the apartment and the elevator 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 floor to floor 0 using the elevator he noticed that the counter shows number Stead of88. Then, the elevator started moving the number on the counter changed to 87. After a little thinking Malek came to the conclusion that there are only one explanation for this:one of the sticks of the Counter was broken. Later that day Malek is thinking about the broken stick and suddenly he came up with the following problem.

Suppose the digital counter is showing number N. Malek calls an integer x (0≤x≤99) Good if it's possible that the Digi Tal 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, must write a program, that calculates, this number. Please note this counter always shows the digits. Input

The only line of input contains exactly the digits representing number n (0≤n≤99). Note that N could have a leading zero. Output

The 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 is supposed to show or 89.

In the second sample the good integers is xx, and 88.

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

Problem-Solving Report: List the number of possible bad cases for each number directly.


/********************************/
/*problem:		codeforces495a  */
/*user: 	    shinelin	    * *
/*memory: 	    0 KB		    */
/*time: 	    ms		    */
/*language: 	g++ */
/********** /
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <string >
#include <list>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <set>
#include <algorithm >
#include <cmath>
using namespace std;

#define INF 0x7fffffff
#define LL long long
int a[10] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2}, N;
int main ()
{
    scanf ("%d", &n);
    printf ("%d\n", A[N/10] * a[n%]);
    return 0;
}


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.