1 solutions

  • 0
    @ 2021-10-26 10:07:44

    P1125题解

    字符串签到题没啥好讲的,注意一下输入有个空格

    #include<stdio.h>
    #include<iostream>
    #include<algorithm>
    #include<string.h>
    #include<ctime>
    using namespace std;
    const int N=1e5+5;
    
    char s1[N];
    char w;
    
    int main()
    {
    	int t;
    	scanf("%d",&t);
    	while(t--){
    		scanf("%s %c",s1,&w);
    		int fg=0;
    		int len=strlen(s1);
    		for(int i=0;i<len;i++){
    			if(s1[i]==w){
    				fg++;
    			}
    		}
    		printf("%d\n",fg);
    		if(fg==2)
    		printf("学长好帅我好爱>v<\n");
    	}
    	return 0;
    }
    

    Information

    ID
    140
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    420
    Accepted
    65
    Uploaded By