hdoj2030 汉字统计
来源:互联网 发布:淘宝宝贝复制破解 编辑:程序博客网 时间:2024/05/19 12:18
汉字统计
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 35606 Accepted Submission(s): 19425
Problem Description
统计给定文本文件中汉字的个数。
Input
输入文件首先包含一个整数n,表示测试实例的个数,然后是n段文本。
Output
对于每一段文本,输出其中的汉字的个数,每个测试实例的输出占一行。
[Hint:]从汉字机内码的特点考虑~
[Hint:]从汉字机内码的特点考虑~
Sample Input
2WaHaHa! WaHaHa! 今年过节不说话要说只说普通话WaHaHa! WaHaHa!马上就要期末考试了Are you ready?
Sample Output
149
Author
lcy
Source
C语言程序设计练习(五)
汉字占两个字符
<pre name="code" class="cpp">#include<iostream>#include<cstdio>#include<string>#include<sstream>#include<cstdlib>#include<cstring>#include<cctype>#include<algorithm>#include<stack>#include<queue>#include<map>#include<set>#include<vector>#include<deque>#include<cmath>#include<climits>#include<list>#include<utility>#include<memory>#include<cstddef>#include<iterator>using namespace std;typedef long long LL;const double pi = acos(-1.0);///////////////////////////////void solve(string input) { string::iterator a = input.begin(); string::iterator b = input.end(); int sum = 0; for (; *a != *b; a++) { if (*a <0) sum++; } cout << sum/2 << "\n"; return;}///////////////////////////////int main(int argc, char**argv) { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); //////////////////////////// int times; cin >> times; cin.ignore(); while (times--) { string input; getline(cin, input); solve(input); // cout<<input<<endl; } //////////////////////////// //system("pause"); return 0;}
0 0
- HDOJ2030 汉字统计
- hdoj2030 汉字的统计
- hdoj2030 汉字统计
- hdoj2030 汉字统计
- hdoj2030 汉字统计
- 汉字统计-汉字内码-HDOJ2030
- HDOJ2030 汉字统计 (汉字机内码特点)
- 汉字统计
- 汉字统计
- 汉字统计
- 汉字统计
- 汉字统计
- 汉字统计
- 汉字统计
- 统计汉字
- 汉字统计
- 汉字统计
- 汉字统计
- LinkedList源码分析
- scrapy 爬网站 显示 Filtered offsite request to 错误.
- Ubutu+Apache+Mono 实现.net开发的网站跨平台移植
- 【bzoj2599】: [IOI2011]Race
- Git从零教你入门(4):Git服务之 gogs部署安装
- hdoj2030 汉字统计
- 【POJ】1258 - Agri-Net(克鲁斯塔尔)(水)
- STM32的bootloader IAP编程(转载总结)
- 改变系统默认的语言,back改为中文,delete改为中文
- Codeforces 628B New Skateboard【数学】
- Android的通讯员——notification
- spark源码学习(六)--- DAGScheduler中的task的划分
- oracle之函数使用大全
- android小问题--------------------SQLiteDatabase.insert(table, nullColumnHack, values)参数