HDU 2030 Kanji Statistics

Source: Internet
Author: User

Problem description counts the number of Chinese characters in a given text file.

The input file first contains an integer n, which indicates the number of test instances, followed by the N-segment text.

Output for each piece of text, outputs the number of characters in it, and the output of each test instance takes one row.

[Hint:] From the characteristics of the Chinese character machine internal code to consider ~

Sample input2wahaha! wahaha! This year the festival does not speak to speak only Putonghua wahaha! Wahaha! 's going to take the final exams right now.

Sample Output149

Authorlcy

Source C language Programming exercises (v)

Recommendlcy | We have carefully selected several similar problems for you:2031 2032 2026 2027 20,241 kanji accounted for two bytes, which is two char, and the ACSII code is negative. Code:
#include <iostream>#include<cstdio>#include<algorithm>#include<cstring>#defineINF 0x3f3f3f3f#defineMAX 100000using namespacestd;intN;Chars[10000];intMain () {scanf ("%d\n",&N);  while(N--) {gets (s); intAns =0;  for(inti =0; S[i];i + +) {            if(S[i] <0) ans + +; } printf ("%d\n", ans/2); }}

HDU 2030 Kanji Statistics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.