HDU-5980
2024-08-29 20:44:25
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 ;
}
最新文章
- MySQL的恢复脚本
- 桌面每日一句--桌面翻译工具(有道翻译,微软翻译,Google翻译)
- ExtJs学习之Window
- 2014年辛星完全解读Javascript第八节 json
- Phoenix Framework对于Tree该方法节点设置不同的图标,每个
- 用DotRas来连接VPN网络
- js-input框中写入的小写小写字母全部转换成大写字母的js代码
- [ISE 14.7]Fail to Link the designer导致无法仿真问题
- 【Android】adb connect 手机的两种方式
- Bigining
- JavaWeb学习篇--Filter过滤器
- 7.1 服务暴露前的准备-ServiceBean的装配
- 利用C#改写JAVA中的Base64.DecodeBase64以及Inflater解码
- canvas绘制进度条(wepy)
- 数学&;搜索:博弈论之极大极小搜索与alpha-beta减枝
- 高效学习Oracle的方法论
- Ceph源码解析:CRUSH算法
- filebeat 简介安装
- 爬虫任务二:爬取(用到htmlunit和jsoup)通过百度搜索引擎关键字搜取到的新闻标题和url,并保存在本地文件中(主体借鉴了网上的资料)
- openvswitch安装
热门文章
- ES通过API调整设置
- linq to xml操作XML(转)
- .NET Winform 将引用的dll文件集成到exe中(转)
- 九度OJ 1145:Candy Sharing Game(分享蜡烛游戏) (模拟)
- 搭建vps***
- jQuery 3D旋转展示焦点图
- 自定义编辑框VC,可加载更改字体,添加背景图片,显示输入提示信息
- 简单的C++程序题总结
- poj 2336 Ferry Loading II ( 【贪心】 )
- poj 1146 ID Codes (字符串处理 生成排列组合 生成当前串的下一个字典序排列 【*模板】 )