Find Small A

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

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

关于二进制的理解应用问题,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 ;
}

最新文章

  1. MySQL的恢复脚本
  2. 桌面每日一句--桌面翻译工具(有道翻译,微软翻译,Google翻译)
  3. ExtJs学习之Window
  4. 2014年辛星完全解读Javascript第八节 json
  5. Phoenix Framework对于Tree该方法节点设置不同的图标,每个
  6. 用DotRas来连接VPN网络
  7. js-input框中写入的小写小写字母全部转换成大写字母的js代码
  8. [ISE 14.7]Fail to Link the designer导致无法仿真问题
  9. 【Android】adb connect 手机的两种方式
  10. Bigining
  11. JavaWeb学习篇--Filter过滤器
  12. 7.1 服务暴露前的准备-ServiceBean的装配
  13. 利用C#改写JAVA中的Base64.DecodeBase64以及Inflater解码
  14. canvas绘制进度条(wepy)
  15. 数学&amp;搜索:博弈论之极大极小搜索与alpha-beta减枝
  16. 高效学习Oracle的方法论
  17. Ceph源码解析:CRUSH算法
  18. filebeat 简介安装
  19. 爬虫任务二:爬取(用到htmlunit和jsoup)通过百度搜索引擎关键字搜取到的新闻标题和url,并保存在本地文件中(主体借鉴了网上的资料)
  20. openvswitch安装

热门文章

  1. ES通过API调整设置
  2. linq to xml操作XML(转)
  3. .NET Winform 将引用的dll文件集成到exe中(转)
  4. 九度OJ 1145:Candy Sharing Game(分享蜡烛游戏) (模拟)
  5. 搭建vps***
  6. jQuery 3D旋转展示焦点图
  7. 自定义编辑框VC,可加载更改字体,添加背景图片,显示输入提示信息
  8. 简单的C++程序题总结
  9. poj 2336 Ferry Loading II ( 【贪心】 )
  10. poj 1146 ID Codes (字符串处理 生成排列组合 生成当前串的下一个字典序排列 【*模板】 )