Chinese character statistics
Chinese character statisticsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission (s): 25457 Accepted Submission (s): 13857
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 Input
2 WaHaHa! WaHaHa! This year, WaHaHa only speaks Mandarin! WaHaHa! The final exam is coming soon. Are you ready?
Sample Output
149 question: as prompted, we obviously know that a Chinese character occupies two bytes, but we do not know much about the Chinese character in ASCLL, this question may not be easy to do, but it is actually very easy to do. There are 128 letters in ASCLL and their corresponding numbers correspond to each other. In this case, there must be no corresponding Chinese characters, it must be negative, so no need to explain the source code: # include
# Include
# Include
Int main () {int n, I, count, len; char str [200]; scanf ("% d", & n); getchar (); while (n --) {count = 0; gets (str); len = strlen (str); for (I = 0; I