HDU-5980
Find Small A
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2268 Accepted Submission(s): 1083Problem DescriptionAs 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).InputThe 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) followOutputOutput one line,including an integer representing the number of 'a' in the group of given numbers.Sample Input3
97 24929 100Sample Output3
关于二进制的理解应用问题,8位即2^8==256,则每个数%256若==97,则sum++
AC代码:
#include<bits/stdc++.h>
using namespace std; int main(){
ios::sync_with_stdio(false);
int t,x;
cin>>t;
int sum=;
while(t--){
cin>>x;
while(x>){
if(x%==){
sum++;
}
x/=;
}
}
cout<<sum<<endl;
return ;
}
HDU-5980的更多相关文章
- HDU 5980 Find Small A(寻找小A)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- hdu 5980 Find Small A(水,模拟)
Find Small A Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tota ...
- HDU 5980 Find Small A (水题)
题意:众所周知,字符 'a' 的ASCII码为97.现在,找出给定数组中出现了多少次 'a' .注意,此处的数字为计算机中的32位整数.这表示, 1个数字由四个字符组成(一个字符由8位二进制数组成). ...
- 2016ACM/ICPC亚洲区大连站现场赛题解报告(转)
http://blog.csdn.net/queuelovestack/article/details/53055418 下午重现了一下大连赛区的比赛,感觉有点神奇,重现时居然改了现场赛的数据范围,原 ...
- HDU 5963 朋友 【博弈论】 (2016年中国大学生程序设计竞赛(合肥))
朋友 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Descr ...
- HDU 5969 最大的位或 【贪心】 (2016年中国大学生程序设计竞赛(合肥))
最大的位或 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem De ...
- HDU 5968 异或密码 【模拟】 2016年中国大学生程序设计竞赛(合肥)
异或密码 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Des ...
- HDU 5961 传递 【图论+拓扑】 (2016年中国大学生程序设计竞赛(合肥))
传递 Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem ...
- HDU 5965 扫雷 【模拟】 (2016年中国大学生程序设计竞赛(合肥))
扫雷 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submissi ...
- hdu 5971 Wrestling Match 判断能否构成二分图
http://acm.hdu.edu.cn/showproblem.php?pid=5971 Wrestling Match Time Limit: 2000/1000 MS (Java/Others ...
随机推荐
- Memcache安装与使用
一.资源下载 安装memcached 之前必需要先安装 libevent 分别在libevent和memcached的官网下载安装包libevent-1.4.14b-stable.tar.gz和mem ...
- redis启动错误-- Creating Server TCP listening socket *:6379: listen: UnKnown error
前提:windows server 2008.redis 3.x 今天给服务器部署redis环境,文件配置.服务安装都很顺利,可就在启动服务的时候提示 百度老半天也没找到个说到点子上的. 这里记录下解 ...
- mongo-connector导入数据到Es
要求 基于mongo-connector同步数据,必须要求mongodb为复制集架构,原因是此插件是基于oplog操作记录进行数据同步的:而oplog可以说是Mongodb Replication的纽 ...
- 关于EF输出sql的执行日志
sqlserver中可以使用sql profiler:但是mysql当中无法查看:只能借助于组件: ADO.NET Entity Framework CodeFirst 如何输出日志(EF4.3) 用 ...
- C#获取网页内容的三种方式(转)
搜索网络,发现C#通常有三种方法获取网页内容,使用WebClient.WebBrowser或者HttpWebRequest/HttpWebResponse... 方法一:使用WebClient (引用 ...
- Locality-sensitive hashing Pr[m(Si) = m(Sj )] = E[JSˆ (Si, Sj )] = JS(Si, Sj )
A hash function that maps names to integers from 0 to 15. There is a collision between keys "Jo ...
- Struts2问题总结
1 如何搭建Struts2开发环境? Struts2 获取 http://struts.apache.org/download.cgi Struts-2.3.16.3-all.zip 创建Web项 ...
- [容易]在O(1)时间复杂度删除链表节点
题目来源:http://www.lintcode.com/zh-cn/problem/delete-node-in-the-middle-of-singly-linked-list/
- 开始Shell编程
开始Shell编程 NT:如无特别说明,下面使用bash shell. 编写脚本只需以下几步: (1) 打开编辑器,写下脚本. (2) 给保存的脚本执行权限. 使用chmod permission y ...
- 玩转Google开源C++单元测试框架Google Test系列(gtest)(总)
原文地址:http://www.cnblogs.com/coderzh/archive/2009/04/06/1426755.html 前段时间学习和了解了下Google的开源C++单元测试框架Goo ...