Topic Link: Click to open the link
Problem Solving Ideas:
Deal with the trouble, the length of the array to save, and then follow the length to fetch, go to see how many lines, and finally in the number of pages can be taken. The highlights are in the branch.
Full code:
#include <algorithm> #include <iostream> #include <cstring> #include <climits> #include < cstdio> #include <string> #include <cmath> #include <map> #include <queue>using namespace std ; typedef long long ll;const int MOD = int (1e9) +7;const int INF = 0x3f3f3f3f;const double EPS = 1e-9;const double PI = ACOs (-1.0); m_pi;string s;const int MAXN = 10001;int Res[maxn];int main () {#ifdef Doubleq freopen ("In.txt", "R", stdin); #endif int A, b, C; while (Cin >> a >> b >> c) {for (int i = 0; i < C; i + +) {cin >> S int len = S.length (); Res[i] = len; } int cnt = 0; for (int i = 0; i < C;) {int sum = res[i]; Int J = i + 1; while (sum + 1 + res[j] <= b) {sum + = 1 + res[j]; j + +; } i = J; CNT + +; } int k = cnt% A = = 0? CNT/A: cnt/a + 1; cout << k << Endl; }}
More highlights please visit: Click to open the link
Ural1881 (Analog)