QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#227883#2942. 7 Segments You Say?Thallium54#AC ✓4ms8048kbC++202.6kb2023-10-28 02:32:322023-10-28 02:32:33

Judging History

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

  • [2023-10-28 02:32:33]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:8048kb
  • [2023-10-28 02:32:32]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
 
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>

 
const int N = 100 + 100;
const int inf = 1e9;
const ll mod =  998244353;
const ld eq = 1e-18;

int n, b[200][N][N], a[N][N];

inline void on(int x, int y)
{
	//cout << x << ' ' << y << endl;
	for(int i = 0; i < 7*n; i++)
	{
		for(int j = 0; j < 3*n; j++)
		{
			if(a[i][j] == y)
				b[x][i][j] = 1;
		}
	}
}

int main()
{
	string s;
	cin >> n >> s;
	while((s.size())%7 != 0)
		s.insert(s.begin(), '0');
	//cout << s << endl;	
	
	for(int i = 0; i < 7*n; i++)
		for(int j = 0; j < 3*n; j++)
			a[i][j] = -1;

	//*
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < 3*n; j++)
			a[i][j] = 6;
	}
	
	for(int i = n; i < 3*n; i++)
	{
		for(int j = 0; j < n; j++)
			a[i][j] = 5;
	}

	for(int i = 3*n; i < 4*n; i++)
	{
		for(int j = 0; j < 3*n; j++)
			a[i][j] = 3;
	}

	for(int i = 4*n; i < 6*n; i++)
	{
		for(int j = 0; j < n; j++)
			a[i][j] = 2;
	}

	
	for(int i = 6*n; i < 7*n; i++)
	{
		for(int j = 0; j < 3*n; j++)
			a[i][j] = 0;
	}
	
	
	////
	for(int i = n; i < 3*n; i++)
	{
		for(int j = 2*n; j < 3*n; j++)
			a[i][j] = 4;
	}
	
	for(int i = 4*n; i < 6*n; i++)
	{
		for(int j = 2*n; j < 3*n; j++)
			a[i][j] = 1;
	}

	//*/

	
	//cout << "////////////////////////////////////" << endl;

	string val[17] = {"1110111", "0100100", "1011101", "1101101", "0101110", "1101011", "1111011", "0100101", "1111111", "1101111", "0111111", "1111010", "1010011", "1111100", "1011011", "0011011"};


	for(int i = 0; i < s.size(); i += 7)
	{
		//cout << i << endl;
		string t = "";
		for(int j = 0; j < 7; j++)
			t += s[i+j];
		
		bool fl = false;
		for(int j = 0; j < 17; j++)
		{
			if(t == val[j])
				fl = 1;
		}
		
		if(!fl)
			continue;
		for(int j = 0; j < 7; j++)
		{	
			if(s[i+j] == '1')
			{
				on(i/7, j);
			}
		}
	}

	int dig = s.size()/7;
	int d = (80+2*n) / (5*n);
	for(int l = 0; l < (dig+d-1)/d; l++)
	{
		for(int i = 0; i < 7*n; i++)
		{
			for(int x = l*d; x < min(l*d + d, dig); x++)
			{
				for(int j = 0; j < 3*n; j++)
				{
					if(b[x][i][j] == 1)
						cout << 'X';
					else
						cout << ' ';	
				}
				if(x+1 == min(l*d + d, dig))
					continue;
					
				for(int j = 0; j < 2*n; j++)
					cout << ' ';
			}
			cout << endl;
			//cout << '|' << endl;
		}
		//cout << "//////////" << endl;
		if(l+1 != (dig+d-1)/d)
		{
			for(int i = 0; i < n; i++)	
				cout << endl;	
		}
	}
	



	
	
	
	
	
	
	
	
	
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3464kb

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: 1ms
memory: 3548kb

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: 1ms
memory: 5544kb

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: 1ms
memory: 7632kb

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

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: 4ms
memory: 8048kb

input:

8 11101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011

output:

XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                ...

result:

ok 1016 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3488kb

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: 1ms
memory: 3404kb

input:

1 0101011

output:

   
   
   
   
   
   
   

result:

ok 7 lines

Test #9:

score: 0
Accepted
time: 1ms
memory: 5548kb

input:

1 100100010010111010111101111010101111110111101111001111001111110011011

output:

     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  
          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  
      ...

result:

ok 7 lines

Test #10:

score: 0
Accepted
time: 2ms
memory: 5584kb

input:

8 100100010010111010111101111010101111110111101111001111001111110011011

output:

                                        XXXXXXXXXXXXXXXXXXXXXXXX
                                        XXXXXXXXXXXXXXXXXXXXXXXX
                                        XXXXXXXXXXXXXXXXXXXXXXXX
                                        XXXXXXXXXXXXXXXXXXXXXXXX
                                        ...

result:

ok 312 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 7668kb

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