华为机试句子重量-华为机试
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
string s;
int i=0;
getline(cin, s);
s += ' ';
int cnt = 0;
int end = 0;
int begin = -1;
int sum = 0;
while (end < s.size()){
while (s[end] != ' ') {
++end;
}
sum += end -1- begin;
begin = end;
cnt++;
++end;
}
printf("%.2lf", (double)sum / cnt);
}
标签:cnt,end,int,重量,begin,单词,include,sum
From: https://www.cnblogs.com/chunbai11/p/16747373.html