1 #include<stdio.h>
 2 #include<stdlib.h>
 3 char str[1100];
 4 int calc(char str[])
 5 {
 6     int i,sum=0;
 7     for(i=0;str[i];i++)
 8     if(str[i]&0x80)  
 9     {sum++;i++;}//这里i++是由于汉字占两个字节, 
10     return sum;
11 }
12 int main()
13 {
14     int n;
15     scanf("%d%*c",&n);
16     while(n--)
17     {
18         gets(str);
19         printf("%d\n",calc(str));
20     }
21     system("pause");
22     return 0;
23 }    
24     
25      

相关文章:

  • 2021-11-06
  • 2022-12-23
  • 2021-09-01
  • 2020-04-17
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-08
  • 2022-12-23
  • 2021-12-27
  • 2022-02-19
  • 2021-08-17
相关资源
相似解决方案