Find Small A

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1112    Accepted Submission(s): 540

Problem Description
As is known to all,the ASCII of character 'a' is 97. Now,find out how many character 'a' in a group of given numbers. Please note that the numbers here are given by 32 bits’ integers in the computer.That means,1digit represents 4 characters(one character is represented by 8 bits’ binary digits).
 
Input
The input contains a set of test data.The first number is one positive integer N (1≤N≤100),and then N positive integersai (1≤ ai≤2^32 - 1) follow
 
Output
Output one line,including an integer representing the number of 'a' in the group of given numbers.
 
Sample Input
3
97 24929 100
 
Sample Output
3
 
Source
 
Recommend
 
 
 #include <bits/stdc++.h>
using namespace std; int main()
{
int n;
int t;
unsigned int a;
int i;
int sum; while (~scanf("%d", &n)) {
sum = ;
for (i = ; i < n; ++i) {
scanf("%d", &t);
a = t;
sum = sum + (((a & 0x000000ff) == ) ? : );
a >>= ;
sum = sum + (((a & 0x000000ff) == ) ? : );
a >>= ;
sum = sum + (((a & 0x000000ff) == ) ? : );
a >>= ;
sum = sum + (((a & 0x000000ff) == ) ? : );
}
printf("%d\n", sum);
} return ;
}
 
 

hdu 5980 Find Small A(水,模拟)的更多相关文章

  1. HDU 5980 Find Small A (水题)

    题意:众所周知,字符 'a' 的ASCII码为97.现在,找出给定数组中出现了多少次 'a' .注意,此处的数字为计算机中的32位整数.这表示, 1个数字由四个字符组成(一个字符由8位二进制数组成). ...

  2. HDU 5980 Find Small A(寻找小A)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  3. CodeForces.158A Next Round (水模拟)

    CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include &l ...

  4. CodeForces.71A Way Too Long Words (水模拟)

    CodeForces71A. Way Too Long Words (水模拟) 题意分析 题怎么说你怎么做 没有坑点 代码总览 #include <iostream> #include & ...

  5. HDU 5268 ZYB loves Score (简单模拟,水)

    题意:计算Bestcoder四题的得分. 思路:直接模拟,4项分数直接计算后输出.注意不要低于百分之40的分. //#include <bits/stdc++.h> #include &l ...

  6. HDU 3682 水模拟

    n*n*n的图形,m条线,每条线上的方格被删除.问一共删除了多少个方格 ans=m*n .然后推断一下直线相交的交点.去重就可以 #include "stdio.h" #inclu ...

  7. HDU 5968 异或密码 【模拟】 2016年中国大学生程序设计竞赛(合肥)

    异或密码 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Des ...

  8. HDU 5949 Relative atomic mass 【模拟】 (2016ACM/ICPC亚洲区沈阳站)

    Relative atomic mass Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  9. HDU 5102 The K-th Distance(模拟)

    题意:输入一棵树,输出前k小的点对最短距离dis(i,j)的和. 模拟,官方题解说得很清楚了.不重复了. http://bestcoder.hdu.edu.cn/ 需要注意的是,复杂度要O(n+k), ...

随机推荐

  1. Docker Libnetwork driver API

    以下内容均在libnetwork/driverapi目录下 Driver接口如下所示: // Driver is an interface that every plugin driver needs ...

  2. Java AES512加密算法

    AES - 高级加密标准: 高级加密标准(英语:Advanced Encryption Standard,缩写:AES),在密码学中又称Rijndael加密法,是美国联邦政府采用的一种区块加密标准.这 ...

  3. HDU4223:Dynamic Programming?(简单dp)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=4223 求连续子序列和的最小绝对值,水题. #include <iostream> #inclu ...

  4. 在用 JavaScript 工作时,我们经常和条件语句打交道,这里有5条让你写出更好/干净的条件语句的建议。

    1.多重判断时使用 Array.includes 2.更少的嵌套,尽早 return 3.使用默认参数和解构 4.倾向于遍历对象而不是 Switch 语句 5.对 所有/部分 判断使用 Array.e ...

  5. PHP获取与操作php.ini文件的几个函数示例

    php有一套设置和获取配置信息的函数,用于设置与修改相关参数信息.   1.ini_get()获取配置参数,ini_set()设置配置参数 <?php 2.ini_get_all()获取所有配置 ...

  6. Part01、memcache 缓存

    Python操作 RabbitMQ.Redis.Memcache.SQLAlchemy 目录 一. Memcached Memcached安装和基本使用 Python操作Memcached2.1 se ...

  7. 通过SSRS创建动态分组报表的方法!

    SSRS是微软专门的报表开发工具,对于一般高级用户(非专业开发人员)可以通过SQL Server Report Builder创建,可以把制作好的发布在单独部署的SQL Server Reportin ...

  8. LeetCode:全排列II【47】

    LeetCode:全排列II[47] 参考自天码营题解:https://www.tianmaying.com/tutorial/LC47 题目描述 给定一个可包含重复数字的序列,返回所有不重复的全排列 ...

  9. Spark --idea无法new scala class

    问题: 无法新建Scala class 解决: 1.下载插件 setting-->Plugins-->安装scala插件-->提示重启idea-->自动提示你安装scala s ...

  10. CodeForces - 86D Powerful array (莫队)

    题意:查询的是区间内每个数出现次数的平方×该数值的和. 分析:虽然是道莫队裸体,但是姿势不对就会超时.答案可能爆int,所以要开long long 存答案.一开始的维护操作,我先在res里减掉了a[p ...