QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#39656 | #2942. 7 Segments You Say? | 2873531385 | WA | 1ms | 3604kb | C++ | 1.9kb | 2022-07-12 17:54:39 | 2022-07-12 17:54:41 |
Judging History
answer
#include <iostream>
#include <vector>
#include <string>
using namespace std;
string s[7] = { "XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ",
"X X X X X X X X X X X X X X X X X X X X X ",
"X X X X X X X X X X X X X X X X X X X X X ",
" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ",
"X X X X X X X X X X X X X X X X X X X X X X ",
"X X X X X X X X X X X X X X X X X X X X X X ",
"XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX "};
string p = "111011101001001011101110110101011101101011111101101001011111111110111101111111111010101001111111001011011001101111101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101";
int getnum(string & tmp) {
for (int i = 0; i<=15; ++i) {
if (tmp==p.substr(i*7, 7)) return i;
}
return -1;
}
int main() {
ios::sync_with_stdio(false);
cout.tie(0);
int n;
cin >>n ;
// n = 2;
{
string ans[7];
for (int i = 0; i<7; ++i) ans[i] = string(1000, ' ');
string in, _in;
cin >> in;
if (in.size()%7) _in = string(7-in.size()%7, '0');
_in+=in;
int len = _in.size();
for (int i = 0; i<len; i+=7) {
string tmp = _in.substr(i, 7);
int num = getnum(tmp);
for (int j = 0; j<7; ++j) {
ans[j][i/7*5] = ' ';
for (int k = i/7*5+1; k<i/7*5+5; ++k) {
ans[j][k] = s[j][num*4+k-i/7*5-1];
}
}
}
for (int i = 0; i<7; ++i) {
cout << ans[i].substr(1, len/7*5) << "\n";
}
}
return 0;
}
/*
1
111011101001001011101110110101011101101011111101101001011111111110111101111111111010101001111111001011011001101111101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3604kb
input:
1 110111111011
output:
XXX XXX X X X X XXX XXX X X X X X X XXX
result:
wrong answer 1st lines differ - expected: 'XXX XXX', found: 'XXX XXX '