主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
小酒
2024年3月15日 15:32
统计字符 题解:
P1320
回复 0
|
赞 0
|
浏览 267
1320解题思路 #include <bits/stdc++.h> using namespace std; int main() { char a[105]={0}; char b[105]={0}; while(gets(a)&&gets(b)) { int count; if(a[0]=='#') break; int l1=strlen(a); int l2=strlen(b); for(int i=0;i<l1;...
799
2024年3月6日 15:17
统计字符 题解:
P1320
回复 0
|
赞 0
|
浏览 246
#include <bits/stdc++.h> using namespace std; char s[10]; char t[100]; int main() { while (gets(s)!=NULL) { gets(t); int ls=strlen(s); int lt=strlen(t); &nbs...
williams
2024年3月6日 10:26
统计字符 题解:c
P1320
回复 0
|
赞 0
|
浏览 256
#include <stdio.h> #include <stdbool.h> #include <math.h> #include <string.h> int main(void) { char in[5],inchar[80]; while(gets(in)!=NULL){ if(in[0]!='#'){ //当输入不等于# fgets(inchar,80,st...
lingdongyang
2024年2月28日 18:50
统计字符 题解:C
P1320
回复 2
|
赞 0
|
浏览 409
char s[10]; char ss[105]; int main() { while (gets(s)!=NULL) { if (strcmp(s,"#") == 0) {//字符串相比较 break;//比较是否输出#从而结束 } gets(ss);//输入字符串 int s1 = strlen(s);//判断有多少个数 int ss1 = strlen(ss); for (int i = 0; i < s1; i++) { int cnt = 0; int flag = 0; for (in...
小王桐学
2024年2月10日 22:20
统计字符 题解:C-easy
P1320
回复 0
|
赞 0
|
浏览 383
#include <stdio.h> #include <string.h> int main() { char t[6],s[81]; while(gets(t) != NULL) { int tt[6] = {0},i,j; if(strcmp(t,"#") == 0) break; gets(s); for(i = 0; i < strlen(t); i++) for(j = 0; j < strlen(s); j++) if(t[i] == s[j]) tt[i]+...
孙某人
2024年2月1日 21:27
统计字符 题解:求助大佬,为什么不能用while(1)是平台的事情吗?
P1320
回复 4
|
赞 0
|
浏览 397
#include <iostream> #include <string.h> using namespace std; int main(){ char a[100][10]; char b[100]; int c[1000]; for(int i=0;i<1000;i++) c[i]=0; for(int i=0;i<100;i++){ b[i]=0; for(int j=0;j<10;j++) a[i][j]=0; } int cc=0; int d=0; while(g...
Hegel
2023年3月27日 20:48
输出字符串s1内的各个字符在字符串s2中出现的次数
P1320
回复 0
|
赞 0
|
浏览 2.1k
#include <iostream> #include <string> using namespace std; int main() { string s1, s2; while (getline(cin, s1)&&getline(cin, s2)) { if(s1=="#") break; for (int i = 0; i < s1.size(); i++) { int sum = 0; for (int j = 0; j < s2.size(); j++) i...
我不是深井冰丶
2023年1月15日 21:31
使用cin遇到空格会结束,可以用getline()
P1320
回复 0
|
赞 1
|
浏览 3.8k
#include<bits/stdc++.h> using namespace std; int main(){ string m,n; int count = 0; while(1){ getline(cin,m); getline(cin,n); if(m == "#") break; for(int i = 0;i < m.length();i++){ for(int j = 0;j < n.length();j++){ if(m[i] == n[j]){ count++; ...
xx_about123456
2022年9月3日 10:19
getline读取一行
P1320
回复 0
|
赞 1
|
浏览 4.5k
getline(cin,str); 读取一行,不会被空格分割开 map_str[str[i]]++; 利用map统计; #include<bits/stdc++.h> using namespace std; int main() { string str,temp; while(getline(cin,temp)) { map<char,int> map_str; ...
ymw1836828452
2020年4月22日 17:34
P1320题解
P1320
回复 0
|
赞 0
|
浏览 8.1k
#include <stdio.h> #include <stdlib.h> int main() {char a[5],b[80],*p; int r=3; while(r--)//这里应该为“1”,因为里面有结束条件,但检测通不过,它认为你这个会无限循环! { gets(a); if(a[0]=='#')break; gets(b); p=a; char e[5]="#####"; ...
题目
统计字符
题解数量
10
发布题解
热门题解
1
getline读取一行
2
使用cin遇到空格会结束,可以用getline()
3
P1320题解
4
统计字符 题解:C
5
统计字符 题解:求助大佬,为什么不能用while(1)是平台的事情吗?
6
统计字符 题解:C-easy
7
统计字符 题解:c
8
统计字符 题解:
9
统计字符 题解:
10
输出字符串s1内的各个字符在字符串s2中出现的次数