#include<cstdio> #include<iostream> #include<string> #include<algorithm> #include<vector> #define L 60 usingnamespacestd;
intmain() { int n; vector<string> file; string str; while (scanf("%d", &n) != EOF) { int max_len = 0; for (int i = 0; i < n; i++) { cin >> str; file.push_back(str); int len = str.length(); if (len > max_len) max_len = len; }
sort(file.begin(), file.end()); int x = 1 + (L - max_len) / (max_len + 2);//一列最多可容納幾個 int r = (int)n / x + (n%x ? 1 : 0);//有幾列