QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#39652#2942. 7 Segments You Say?2873531385RE 0ms0kbC++1.9kb2022-07-12 17:51:412022-07-12 17:51:42

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 17:51:42]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2022-07-12 17:51:41]
  • 提交

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-1] = ' ';
				for (int k = i/7*5; k<i/7*5+4; ++k) {
					ans[j][k] = s[j][num*4+k-i/7*5];
				}
			}
		}
		for (int i = 0; i<7; ++i) {
			cout << ans[i].substr(0, len/7*5) << "\n";
		}
	
	}


	return 0;
}

/*
1
111011101001001011101110110101011101101011111101101001011111111110111101111111111010101001111111001011011001101111101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

1 110111111011

output:


result: