九度:1021<统计字符>
来源:互联网 发布:达内云笔记数据库 编辑:程序博客网 时间:2024/05/29 04:58
http://ac.jobdu.com/problem.php?pid=1021
// 浙大2007年机试// 九度:1021// 题目:统计字符// // 考察:统计,比较,记录// // // // // #include <stdio.h>#include <cctype>#include <cmath>#include <cstring>#include <iostream>#include <string>#include <algorithm>#include <vector>#include <queue>#include <stack>#define SIZE 10using namespace std;struct Node{char c;int count;Node():c(0), count(0){};};Node buf[SIZE];int len;void Init(){len = 1;buf[0].count=0;for(int i =1; i<SIZE; i++){buf[i].c=0;buf[i].count=0;}}void Input(){char ch;while(scanf("%c", &ch) && ch != '\n'){buf[len++].c = ch;}}void Static(){int i;char ch;while(scanf("%c", &ch) && ch != '\n'){for(i=0; i<len; i++){if(ch == buf[i].c){buf[i].count++;}}}}void Print(){int i;for(i=0; i<len; i++){printf("%c %d\n", buf[i].c, buf[i].count);}}int main(){#ifdef ONLINE_JUDGE#elsefreopen("E:\\in.txt", "r" , stdin);#endifwhile(scanf("%c", &buf[0].c) && buf[0].c != '#'){Init();Input();Static();Print();}//whilereturn 0;}
0 0
- 九度1021 统计字符
- 九度1021 统计字符
- 九度:1021<统计字符>
- 九度1021:统计字符
- 九度OJ 1021 统计字符
- 九度OnlineJudge之1021:统计字符
- 【九度】题目1021:统计字符
- 九度OJ 1021统计字符----20140728
- 九度OJ 题目1021:统计字符
- 九度 OJ 1021:统计字符
- 九度OJ 1021 统计字符
- 九度OJ-题目1021 统计字符
- 九度论坛--上机题1021:统计字符
- 九度OJ—题目1021:统计字符
- 九度OJ 1021 统计字符 (模拟)
- 题目1021题 统计字符 九度Online Judge
- 九度OJ 1021:统计字符 (基础题)
- 九度笔记之 统计字符
- cocos2d-x iOS和Android同步开发 手机设备适配问题解决
- JAVA游戏开发之FPS精准控制
- 游戏框架设计—— 游戏中的事件机制
- 递归遍历文件夹里的文件
- JDBC
- 九度:1021<统计字符>
- myeclipse10.7.1破解时,run.bat一闪就没了,解决方法
- 递归搜索文件,并写入目的文件成列表
- 2014年度计划1——健康生活
- IOS AVFoundation的录音与播放
- 修复Windows 7 Aero特效无法显示
- 黑马程序员- 第十天(线程)
- Socket通信原理和实践
- poj 3624 Charm Bracelet DP 0/1 背包问题