Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define F first
- #define S second
- #define mp make_pair
- #define pb push_back
- #define INF 0x3f3f3f3f
- #define LINF 0x3f3f3f3f3f3f3f3fLL
- using namespace std;
- typedef long long ll;
- typedef vector<int> vi;
- typedef set<int> si;
- typedef pair<int,int> ii;
- typedef vector<ii> vii;
- typedef map<string,int> msi;
- typedef map<int,int> mi;
- int main(){
- int n,l,c;
- while(!cin.eof()){
- cin >>n>>l>>c;
- unsigned long int chars = c;
- unsigned long int lines = l;
- unsigned long int pages = 1;
- for(int i=0;i<n;i++){
- string word;
- cin>>word;
- if(word.size() > chars){
- chars =c-word.size();
- lines--;
- if(lines ==0){
- lines =l;
- pages++;
- }
- }else{
- chars-=word.size();
- }
- if(chars>0)chars--;
- }
- cout << pages<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement