标签:iostream cto ESS namespace mat return else ret style
https://codeforces.com/group/5yyKg9gx7m/contest/270203/problem/E
分析:
#include <stdio.h> #include <cstring> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <iostream> using namespace std; int main() { int n,k; cin>>n>>k; char str[106][17]; int len[106]; for(int i=1;i<=n;i++) { scanf("%s",str[i]); len[i]=strlen(str[i]); } int r=k; for(int i=1;i<=n;i++) { if(r>=len[i]) { printf("%s ",str[i]); r-=len[i]; } else { printf("\n%s ",str[i]); r=k-len[i]; } } return 0; }
标签:iostream cto ESS namespace mat return else ret style
原文地址:https://www.cnblogs.com/studyshare777/p/12404946.html