QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#39670#2942. 7 Segments You Say?2873531385WA 2ms3676kbC++2.4kb2022-07-12 18:28:322022-07-12 18:28:33

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-12 18:28:33]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3676kb
  • [2022-07-12 18:28:32]
  • 提交

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) {
				cout << "   ";
				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: 2ms
memory: 3676kb

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: 3600kb

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: 2ms
memory: 3524kb

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: 3516kb

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: 2ms
memory: 3612kb

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: 3528kb

input:

1 1111111

output:

XXX
X X
X X
XXX
X X
X X
XXX


result:

ok 7 lines

Test #8:

score: -100
Wrong Answer
time: 2ms
memory: 3600kb

input:

1 0101011

output:

   

result:

wrong answer 2nd lines differ - expected: '   ', found: ''