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;}