UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#171363#1003. 斜线输出(1)heyuzhen1000ms1200kbC++396b2023-06-22 21:56:212023-06-22 21:56:23

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int a,b[25][25];
int main(){
	cin >> a;
	for(int i = a;i >= 1;i--)
		for(int j = 1;j <= a;j++)
			cin>>b[j][i];
for(int k = 1;k <= a * 2 - 1;k++)
	if(k <= a)
		for(int i = 1,j = k;j >= 1;i++,j--)
			cout << b[i][j] << " ";
	else for(int i = k - a + 1,j = a;i <= a;i++,j--)
		cout << b[i][j] << " ";
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 33
Accepted
time: 0ms
memory: 1200kb

input:

3
2 4 9
0 7 4
2 8 5

output:

2 0 8 2 7 5 4 4 9 

result:

ok single line: '2 0 8 2 7 5 4 4 9 '

Test #2:

score: 33
Accepted
time: 0ms
memory: 1200kb

input:

3
57 22 98
4 54 92
28 15 41

output:

28 4 15 57 54 41 22 92 98 

result:

ok single line: '28 4 15 57 54 41 22 92 98 '

Test #3:

score: 33
Accepted
time: 0ms
memory: 1200kb

input:

12
1 93 31 96 5 40 46 8 23 42 92 45
16 79 56 52 28 77 95 62 38 48 2 5
42 64 94 37 50 50 24 1 15 7 25...

output:

46 51 47 9 58 30 39 6 48 46 8 20 59 62 47 82 78 30 90 9 65 92 63 89 58 71 66 39 33 63 35 12 50 72 96...

result:

ok single line: '46 51 47 9 58 30 39 6 48 46 8 ...52 23 48 25 92 42 2 10 92 5 45 '