The Problem description counts the number of Chinese characters in a given text file. The input file contains an integer N, indicating the number of test instances, followed by N text segments. Output outputs the number of Chinese characters for each piece of text, and the output of each test instance occupies one line.
[Hint:] Considering the characteristics of inner codes of Chinese Characters ~
Sample input2wahaha! Wahaha! This year, Wahaha only speaks Mandarin! Wahaha! The final exam is coming soon. Are you ready? Sample output149
1 # include <stdio. h> 2 3 int main () {4 int t; 5 char C; 6 int amount; 7 8 scanf ("% d", & T); 9 getchar (); 10 11 while (t --) {12 amount = 0; 13 while (C = getchar ())! = '\ N') {14 if (C <0 | C> 127) 15 amount ++; 16} 17 printf ("% d \ n ", amount/2); 18} 19 20 21 return 0; 22}
Chinese character statistics