首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
xsw
2026年2月3日 17:03
统计单词 题解:
P1394
回复 0
|
赞 6
|
浏览 293
#include<iostream> using namespace std; int main() { string s; while (getline(cin, s)) { int cnt = 0; for (int i = 0; i < s.size(); i ++ ) { if (s[i] != ' ' && s[i] != '.') { cnt ++ ; } else { if (cnt) cout << cnt << ' '; cn...
kawhileo
2026年1月31日 23:04
统计单词 题解:有坑——句号前会有空格
P1394
回复 0
|
赞 4
|
浏览 350
#include<bits/stdc++.h> using namespace std; int main() { string s; while(getline(cin,s)){//一行全部都进来给s int len=s.size(); int c[len]={0}; int word_len=0,word_num=0,tag=1;//...
mlx
2026年1月30日 22:03
统计单词 题解:
P1394
回复 0
|
赞 5
|
浏览 332
#include<iostream> using namespace std; char s[1010]; int main() { string str; while(cin.getline(s,110)) { int cnt=0; for(int i=0;s[i]!='.';i++) { if(s[i]>='a'&&s[i]<='z') { cnt++; if(s[i+1]==' '||s[i+1]=='.') { cout<<...
yauqq
2026年1月29日 09:59
统计单词 题解:
P1394
回复 0
|
赞 4
|
浏览 268
#include<bits/stdc++.h> using namespace std; int main(){ char c; int length = 0; while(cin.get(c)){ if(c == '.'){ if(length > 0) cout << length; cout << endl; length = 0; } else{ if(isspace(c)){ if(length > 0){ cout <&...
SpontySoul
2026年1月25日 17:40
统计单词 题解:
P1394
回复 0
|
赞 3
|
浏览 382
#include <bits/stdc++.h> using namespace std; int main() { string s; while(getline(cin, s)){ size_t len = s.size(); s[len - 1] = ' '; // 将末尾的.换成空格 int l = 0; for(size_t i = 0; i < len; i++){ if(s[i] != ' ') ...
曾不会
2026年1月24日 18:08
统计单词 题解:
P1394
回复 0
|
赞 1
|
浏览 268
长度为0的时候不要输出就好了 while(1): try: num = list(map(str, input().split())) n = len(num) for i in range(n): k = list(num[i]) if (i == n - 1): if(len(k)-1==0): { } e...
曾不会
2026年1月24日 18:06
统计单词 题解:
P1394
回复 0
|
赞 0
|
浏览 264
分析每一种情况 #include<bits/stdc++.h> int main() { char c; int count=0; while(c=getchar()) { if(c!='.') { ...
奶龙大王
2026年1月16日 19:55
统计单词 题解:
P1394
回复 0
|
赞 3
|
浏览 362
多空格和.号细节处理 #include <stdio.h> #include <string.h> #include<iostream> using namespace std; int main() { string s; int t=0; getline(cin,s);//自定义getline结束符,cin不能读空格 ...
cczz
2025年8月5日 20:55
统计单词 题解:
P1394
回复 0
|
赞 7
|
浏览 986
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(getline(cin, s)){ int cnt = 0; char before = ' '; for(int i = 0; i < s.length(); i ++){ char ch = s[i]; if(!isspace(ch)){ // 当前为字母 // 判断是否为句点 if(ch != '.') cnt ++; els...
山崎友希
2025年3月27日 20:08
统计单词 题解:
P1394
回复 0
|
赞 13
|
浏览 1.4k
#include<stdio.h> #include<string.h> #define MAXSIZE 100 int main(){ char string[MAXSIZE]; while( gets(string) ){ int i=0; int length;  ...
1
2
3
4
...
6
题目
统计单词
题解数量
60
发布题解
在线答疑
热门题解
1
统计单词 题解:写出这么简单的代码也是神人了
2
纯纯逆天测试例(‘.'前有可能是空格)
3
统计单词 题解:
4
统计单词 题解:
5
统计单词 题解:c++
6
统计单词 题解:
7
统计单词 题解:可过,判断条件很简单
8
统计单词(C++) 题解:
9
统计单词 题解:
10
统计单词 题解: