10878 Decode the tape

C++语言: Codee#25711
001 /*
002 +++++++++++++++++++++++++++++++++++++++
003                 author: chm
004 +++++++++++++++++++++++++++++++++++++++
005 */
006
007 #include <map>
008 #include <set>
009 #include <list>
010 #include <queue>
011 #include <cmath>
012 #include <stack>
013 #include <bitset>
014 #include <cstdio>
015 #include <cctype>
016 #include <vector>
017 #include <cstdlib>
018 #include <cstring>
019 #include <fstream>
020 #include <sstream>
021 #include <iomanip>
022 #include <iostream>
023 #include <algorithm>
024
025 using namespace std;
026
027 FILE*            fin         = stdin;
028 FILE*            fout         = stdout;
029 const int        max_size     = 10086;
030
031 int main()
032 {
033 #ifndef ONLINE_JUDGE
034     freopen("c:\\in.txt", "r", stdin);
035     fout = fopen("c:\\garage\\out.txt", "w");
036 #endif
037     char str[99];
038     char pick[99];
039     fgets(str, sizeof(str), stdin);
040     while(fgets(str, sizeof(str), stdin) && str[1] != '_')
041     {
042         memset(pick, 0, sizeof(pick));
043         memcpy(pick, str + 1, 5);
044         memcpy(pick + 5, str + 7, 3);
045         for(int i = 0; i < 8; ++i)
046             if(pick[i] == 'o')
047                 pick[i] = '1';
048             else
049                 pick[i] = '0';
050         fprintf(fout, "%c", (char)(strtol(pick, NULL, 2)));
051     }
052
053
054
055
056 #ifndef ONLINE_JUDGE
057     fclose(fout);
058     system("c:\\garage\\check.exe");
059     system("notepad c:\\garage\\out.txt");
060 #endif
061     return 0;
062 }
063 /*
064 010000001  = 'A'
065 ___________
066 | o   .  o|
067 |  o  .   |
068 | ooo .  o|
069 | ooo .o o|
070 | oo o.  o|
071 | oo  . oo|
072 | oo o. oo|
073 |  o  .   |
074 | oo  . o |
075 | ooo . o |
076 | oo o.ooo|
077 | ooo .ooo|
078 | oo o.oo |
079 |  o  .   |
080 | oo  .oo |
081 | oo o.ooo|
082 | oooo.   |
083 |  o  .   |
084 | oo o. o |
085 | ooo .o o|
086 | oo o.o o|
087 | ooo .   |
088 | ooo . oo|
089 |  o  .   |
090 | oo o.ooo|
091 | ooo .oo |
092 | oo  .o o|
093 | ooo . o |
094 |  o  .   |
095 | ooo .o  |
096 | oo o.   |
097 | oo  .o o|
098 |  o  .   |
099 | oo o.o  |
100 | oo  .  o|
101 | oooo. o |
102 | oooo.  o|
103 |  o  .   |
104 | oo  .o  |
105 | oo o.ooo|
106 | oo  .ooo|
107 |  o o.oo |
108 |    o. o |
109
110 A quick brown fox jumps over the lazy dog.
111    */

编辑器加载中...

原文地址:https://www.cnblogs.com/invisible/p/2376285.html