首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
山崎友希
2025年3月27日 20:08
统计单词 题解:
P1394
回复 0
|
赞 6
|
浏览 407
#include<stdio.h> #include<string.h> #define MAXSIZE 100 int main(){ char string[MAXSIZE]; while( gets(string) ){ int i=0; int length;  ...
西电机试专家
2025年3月11日 17:57
统计单词 题解:写出这么简单的代码也是神人了
P1394
回复 0
|
赞 31
|
浏览 621
#include <bits/stdc++.h> using namespace std; //遇到单词就开始计数,遇到空格计数归零 int main(){ string s; while(getline(cin,s)) { int ans=0; for(int i=0;i<s.size();...
quyang
2025年3月9日 10:25
统计单词 题解:可过,判断条件很简单
P1394
回复 0
|
赞 12
|
浏览 526
#include <iostream> using namespace std; #include<string> int main() { string s; while(getline(cin,s)){ int i=0; while(s[i]!='.'){ &nb...
Chen沧月有泪
2025年2月17日 10:06
统计单词 题解:
P1394
回复 0
|
赞 25
|
浏览 754
//如果正确率是80%,考虑以下例子:asd asd .句号前有空格 #include<iostream> #include<string> int main() { std::string s=""; while (std::getline(std::cin,s)) { int cnt = 0; ...
zhizhuo_1
2025年1月9日 23:21
统计单词 题解:
P1394
回复 0
|
赞 7
|
浏览 731
#include <bits/stdc++.h> using namespace std; //不用动脑子的暴力解法,实际上就是依次统计进一个数组中输出 int main(){ string s; getline(cin,s); int cnt[10000]={0}; int flag = 0; int count = 0; int len = s.length(); ...
ccccccyes
2024年9月6日 21:27
统计单词 题解:
P1394
回复 0
|
赞 10
|
浏览 2.2k
//考虑多个空格的情况,直接排除0的输出 ,包括空格结束和末尾句号的判定 // 补足多加的1 //06/09/24 21:04 //06/09/24 21:26 #include <iostream> using namespace std; int main(){ string str; while(getline(cin,str)){ int cnt = 0; for(int i = 0; i<str.size(); i++){ if(str[i] == '.'){ if(cnt...
周小黑02477
2024年3月6日 18:44
纯纯逆天测试例(‘.'前有可能是空格)
P1394
回复 3
|
赞 32
|
浏览 2.8k
#include<bits/stdc++.h> using namespace std; int main() { string s; while (getline(cin,s)) { int len = s.length(); int count = 0; for (int i = 0; i < len; i++) { if (s[i] != ' ' && s[i] != '.') count++; else if (s[i] == ' ') { cout &...
Candour
2024年4月28日 23:50
统计单词(C++) 题解:
P1394
回复 0
|
赞 12
|
浏览 1.1k
#include<bits/stdc++.h> using namespace std; string str; int main() { while(getline(cin, str)) { int cnt = 0; for(int i = 0; i < str.size(); i ++) { if(str[i] != ' ') cnt ++; if((str[i - 1] == ' ' && str[i] ...
RingoCrystal
2024年4月5日 08:42
统计单词 题解:测试用例只有一个坑,别的很基本
P1394
回复 0
|
赞 8
|
浏览 1.1k
#include <bits/stdc++.h> using namespace std; int main(){ string s; vector<string> sheet; while(cin>>s){ sheet.push_back(s); } vector<int> ans; for(int i=0;i<sheet.size();i++){ ans.push_back(sheet[i].size()); } ans[ans.size()-1]--; for(cons...
林——sir
2024年3月23日 09:03
统计单词 题解:
P1394
回复 0
|
赞 1
|
浏览 896
#include <bits/stdc++.h> using namespace std; int main() { string s; while (cin >> s) { int len = s.length(); if (s[len - 1] == '.') &...
1
2
3
...
5
题目
统计单词
题解数量
41
发布题解
在线答疑
热门题解
1
纯纯逆天测试例(‘.'前有可能是空格)
2
统计单词 题解:写出这么简单的代码也是神人了
3
统计单词 题解:
4
统计单词(C++) 题解:
5
统计单词 题解:可过,判断条件很简单
6
统计单词 题解:
7
统计单词 题解:测试用例只有一个坑,别的很基本
8
就挺离谱的。。
9
统计单词 题解:
10
统计单词 题解: