Nbut 1219 Time

Source: Internet
Author: User

  • [1219] Time
  • Time limit: Ms Memory limit: 131072 K
  • Problem description

  • Input
  • There is several test cases.
    Each case contains 4 integers in a line, separated by space.
    Proceed to the end of file.
  • Output
  • For each test case, the output of the time expressed by the digital clock such as Sample output.
  • Sample input
  • 1 2 5 62 3 4 2
  • Sample output
  •     _  _  _   | _|| _ |_   || _  _|| _| _  _     _  _| _|| _| _|| _  _|  
  • Tips
  • The digits showed by the digital clock is as follows: _ _ _ _ _ _ _ _  | _| _| | _|| _ |_   || _|| _|| | || _  _|  | _|| _|  || _| _|| _|
  • Source
  • Liaoning Province Race 2010

    The title is also very simple is to use a string to simulate the clock, note that each number accounted for three, the most violent method is to directly define the three character array, as required output, and one point is 0 in the last, to special treatment.
    #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include < cstdio> #include <string> #include <vector> #include <cmath> #include <ctime> #include < queue> #include <stack> #include <set> #include <map>using namespace std;typedef long Long ll;const int maxn= 100000 + 10;char S1[35]= "_ _ _ _ _ _ _ _"; Char s2[35]= "| _| _|| _|| _ |_   || _|| _|| |"; Char s3[35]= "| |  _  _| | _||  _| || _| _|| _|";    int main () {int a,b,c,d;        while (~SCANF ("%d%d%d%d", &a,&b,&c,&d)) {GetChar ();        if (a==0) a=10;        if (b==0) b=10;        if (c==0) c=10;        if (d==0) d=10; printf ("%c%c%c%c%c%c%c%c%c%c%c%c\n", s1[a*3-2],s1[a*3-1],s1[a*3],s1[b*3-2],s1[b*3-1],s1[b*3],s1[c*3-2],s1[c*3-1        ],S1[C*3],S1[D*3-2],S1[D*3-1],S1[D*3]); printf ("%c%c%c%c%c%c%c%c%c%c%c%c\n", S2[a*3-2],s2[a*3-1],s2[a*3],s2[b*3-2],s2[b*3-1],s2[b*3],S2[C*3-2],S2[C*3-1],S2[C*3],S2[D*3-2],S2[D*3-1],S2[D*3]); printf ("%c%c%c%c%c%c%c%c%c%c%c%c\n", s3[a*3-2],s3[a*3-1],s3[a*3],s3[b*3-2],s3[b*3-1],s3[b*3],s3[c*3-2],s3[c*3-1    ],S3[C*3],S3[D*3-2],S3[D*3-1],S3[D*3]); } return 0;}

    This is the first to write the pure violence method, look not coordination ah ... +_+ ...
    #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include < cstdio> #include <string> #include <vector> #include <cmath> #include <ctime> #include < queue> #include <stack> #include <set> #include <map>using namespace std;typedef long Long ll;const int maxn= 100000 + 10;char S[3][35]= {"_ _ _ _ _ _ _ _ _", "| _| _|| _|| _ |_   || _|| _|| |",                 "   ||  _  _| | _||  _| || _| _|| _|"                }; int A[4];int Main () {while (~SCANF ("%d", &a[0]) {for (int i=1; i<4; i++) scanf ("%d", &a[i])        ;        for (int i=0; i<4; i++) if (!a[i]) a[i]+=10;                for (int i=0, i<3; i++) {for (int j=0; j<4; J + +) {int t=a[j];            printf ("%c%c%c", s[i][t*3-2],s[i][t*3-1],s[i][t*3]);        } puts (""); }} return 0;}

    O (∩_∩) o haha ~ this looks much fresher.
    there is a way to compare the cock, according to the Code of the Lord God (I do not know how long the head of God, is not the same as ordinary people thinking ... All right ...%>_<% ... There is no denying the fact that you are too stupid ... ORZ), although I do not understand at present, but still paste up, ask the great God enlighten ^_^
    #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include < cstdio> #include <string> #include <vector> #include <cmath> #include <ctime> #include < queue> #include <stack> #include <set> #include <map>using namespace std;typedef long Long ll;const int maxn= 100000 + 10;char s[50][50];int data[]={119,36,93,109,46,107,123,37,127,111};int slove (int p,int x) {x=data[x    ];    if (x>>0&1) s[0][p+1]= ' _ ';    if (x>>1&1) s[1][p+0]= ' | ';    if (x>>2&1) s[1][p+2]= ' | ';    if (x>>3&1) s[1][p+1]= ' _ ';    if (x>>4&1) s[2][p+0]= ' | ';    if (x>>5&1) s[2][p+2]= ' | '; if (x>>6&1) s[2][p+1]= ' _ ';}    int main () {int a[5];        while (~SCANF ("%d", &a[0]) {for (int i=1; i<4; i++) scanf ("%d", &a[i]);        memset (S, ', sizeof (s));        for (int i=0;i<3;i++) s[i][12]=0; for (int i=0;i<4;i++) Slove (i*3,A[i]);    for (int i=0;i<3;i++) printf ("%s\n", S[i]); } return 0;}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Nbut 1219 Time

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.