2 条题解

  • 0
    @ 2023-1-2 16:57:33

    #include<bits/stdc++.h> using namespace std; int main() { int l,a=0; string s; cin>>s; l=s.size(); for(int i=0;i<l;i++) { if(s[i]>='A'&&s[i]<='Z') a++; } cout<<a; return 0; }

    • 0
      @ 2022-12-9 0:58:44

      C :

      #include<stdio.h>
      #include<string.h>
      int main(){		
      	char s[1000];
      	gets(s);
      	int len=strlen(s),i,n=0;
      	for(i=0;i<len;i++){
      		if(s[i]>='A'&&s[i]<='Z'){
      			n++;
      		}
      		
      	}
      	printf("%d",n);
      	return 0; 
      	}
      

      Python :

      # coding=utf-8
      s = input()
      n = 0
      i = ord(s[n])
      c = 0
      while i != 46:
          if i >= 65 and i<= 90:
              c = c + 1
              n = n + 1
              i = ord(s[n])
               
          else:
              n = n + 1
              i = ord(s[n])
      print(c)
      
      • 1

      【入门】统计大写英文字母的个数

      信息

      ID
      43
      时间
      1000ms
      内存
      16MiB
      难度
      3
      标签
      递交数
      86
      已通过
      46
      上传者