-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1506.cpp
More file actions
39 lines (38 loc) · 807 Bytes
/
1506.cpp
File metadata and controls
39 lines (38 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
void Print(int* A,int m,int k)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < k; j++)
{
int h = j * m + i;
if (A[h] < 0)
cout << " ";
if (A[h] > -1 && A[h] < 10)
cout << " " << A[h];
if (A[h] > 9 && A[h] < 100)
cout << " " << A[h];
if (A[h] > 99 && A[h] < 1000)
cout << " " << A[h];
}
cout << endl;
}
}
int main()
{
int n, k;
cin >> n >> k;
int m = n / k;
if (n % k != 0)
m++;
int* A = new int[m * k];
for (int i = 0; i < n; i++)
{
cin >> A[i];
}
for (int i = n; i < m * k; i++)
A[i] = -1;
Print(A, m, k);
return 0;
}