博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2016 ICPC大连赛区 [Cloned]J - Find Small A
阅读量:3930 次
发布时间:2019-05-23

本文共 1355 字,大约阅读时间需要 4 分钟。

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

397 24929 100

Sample Output

3

给你n个32位整数,每个整数可以表示成4个字符(因为一个字符在计算机中占8位),问n个整数共包含多少个字符'a'

由于一个字符占二进制8位,所以每个整数相当于转化为2^8=256进制数

那么将32位整数循环对256取模,看是不是97(字符'a')即可

把256换成10 进行10进制的运算一下就看懂了

/*Sherlock and Watson and Adler*/#pragma comment(linker, "/STACK:1024000000,1024000000")#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define eps 1e-9#define LL long long#define PI acos(-1.0)#define bitnum(a) __builtin_popcount(a)using namespace std;const int N = 5005;const int M = 100005;const int inf = 1000000007;const int mod = 1000000007;const int MAXN = 100005;int main(){ int n,i,ans; __int64 a; while(~scanf("%d",&n)) { ans=0; for(i=0;i

 

转载地址:http://aotgn.baihongyu.com/

你可能感兴趣的文章
从数组形式创建一棵树(用于leetcode测试)
查看>>
线程进阶:多任务处理(17)——Java中的锁(Unsafe基础)
查看>>
Spring/Boot/Cloud系列知识(1)——开篇
查看>>
线程基础:多任务处理(15)——Fork/Join框架(要点2)
查看>>
线程基础:多任务处理(16)——Fork/Join框架(排序算法性能补充)
查看>>
线程基础:多任务处理(14)——Fork/Join框架(要点1)
查看>>
架构设计:系统存储(13)——MySQL横向拆分与业务透明化(1)
查看>>
架构设计:系统存储(14)——MySQL横向拆分与业务透明化(2)
查看>>
架构设计:系统存储(5)——MySQL数据库性能优化(1)
查看>>
架构设计:系统存储(2)——块存储方案(2)
查看>>
架构设计:系统间通信(45)——阶段性问题记录
查看>>
架构设计:系统间通信(44)——自己动手设计ESB(5)
查看>>
架构设计:系统存储(1)——块存储方案(1)
查看>>
架构设计:系统间通信(42)——自己动手设计ESB(3)
查看>>
在工作时走神的闪光
查看>>
Ajax使用注意事项
查看>>
FileChannel 专讲
查看>>
使用FileChannel下载本地文件及扩展
查看>>
linux文件权限与目录配置问题与解答(整理篇)
查看>>
linux文件与目录管理问题与回答(整理篇)
查看>>