QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#39673 | #2942. 7 Segments You Say? | 2873531385 | WA | 2ms | 3680kb | C++ | 2.5kb | 2022-07-12 18:32:12 | 2022-07-12 18:32:13 |
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);
if (num==-1) {
for (int i = 0; i<7; ++i) {
for (int ll = 0; ll<n*3; ++ll) cout << ' ';
cout << "\n";
}
return 0;
}
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];
}
}
}
int t = 80/(n*5);
// cout << t << "\n";
for (int k = 0; k<len/7*5-1; k+=5*t) {
for (int i = 0; i<7; ++i) {
for (int ll = 1; ll<=n; ++ll) {
for (int j = k; j<min(k+5*t-1, len/7*5-1); ++j) {
if (j==k) continue;
for (int l = 1; l<=n; ++l) cout << ans[i][j];
}
cout << "\n";
}
}
for (int ll = 1; ll<=n; ++ll)
cout << "\n";
}
// for (int i = 0; i<7; ++i) {
// cout << ans[i].substr(1, len/7*5-2) << "\n";
// }
}
return 0;
}
/*
1
111011101001001011101110110101011101101011111101101001011111111110111101111111111010101001111111001011011001101111101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
input:
1 110111111011
output:
XXX XXX X X X X XXX XXX X X X X X X XXX
result:
ok 7 lines
Test #2:
score: 0
Accepted
time: 2ms
memory: 3680kb
input:
4 110111111011
output:
XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXX...
result:
ok 28 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
1 1110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011
output:
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 ...
result:
ok 7 lines
Test #4:
score: 0
Accepted
time: 2ms
memory: 3484kb
input:
1 111011101001001011101110110101011101101011111101101001011111111110111101111111111010101001111111001011011001101111101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101
output:
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 ...
result:
ok 23 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
3 11101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011
output:
XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ...
result:
ok 165 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
8 11101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011
output:
XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX ...
result:
ok 1016 lines
Test #7:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
1 1111111
output:
XXX X X X X XXX X X X X XXX
result:
ok 7 lines
Test #8:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
1 0101011
output:
result:
ok 7 lines
Test #9:
score: -100
Wrong Answer
time: 2ms
memory: 3660kb
input:
1 100100010010111010111101111010101111110111101111001111001111110011011
output:
result:
wrong answer 1st lines differ - expected: ' XXX XXX XXX XXX XXX XXX XXX', found: ' '