input | output |
---|---|
3 5 6 To be or not to be |
2 |
1 #include<iostream> 2 #include<string.h> 3 #include<stdio.h> 4 #include<ctype.h> 5 #include<algorithm> 6 #include<stack> 7 #include<queue> 8 #include<set> 9 #include<math.h> 10 #include<vector> 11 #include<map> 12 #include<deque> 13 #include<list> 14 using namespace std; 15 int main() 16 { 17 char s[10010]; 18 int a,b,c,d,x=1,e,f=0; 19 scanf("%d%d%d%",&a,&b,&c); 20 gets(s); 21 f=strlen(s); 22 e=1; 23 c--; 24 while(c--) 25 { 26 gets(s); 27 d=strlen(s); 28 if(f+d+1>b) 29 { 30 e++; 31 f=d; 32 } 33 else 34 f+=(d+1); 35 if(e>a) 36 { 37 e=1; 38 x++; 39 } 40 } 41 printf("%d\n",x); 42 return 0; 43 }
URAL 1881 Long problem statement,布布扣,bubuko.com
URAL 1881 Long problem statement
原文:http://www.cnblogs.com/qscqesze/p/3854184.html