mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
28 lines
421 B
C
28 lines
421 B
C
#include <stdio.h>
|
|
|
|
int n, box[1005];
|
|
|
|
int main() {
|
|
scanf("%d", &n);
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
int x;
|
|
|
|
scanf("%d", &x);
|
|
|
|
for (int j = 1; j <= n; j++) {
|
|
if (box[j] + x <= 100) {
|
|
printf("%d %d\n", x, j);
|
|
box[j] += x;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
while (box[n] == 0) n--;
|
|
|
|
printf("%d\n", n);
|
|
|
|
return 0;
|
|
}
|