[HDU-5980] [Problem J]水题
2017-06-09 16:48
357 查看
这道题的题意就给你一个数字大小在2的32次方以下, 也就是说开个50左右的数组就行了, 然后判断从左边第一位开始直到第八位按照十进制的方法加起来是否等于97;
每八位是一个数字 ,统计一下有几个97;
//
// main.cpp
// 160929
//
// Created by 刘哲 on 17/5/30.
// Copyright © 2016年 my_code. All rights reserved.
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <bitset>
#include <stack>
#include <stdlib.h>
#define lowbit(x) (x&-x)
typedef long long ll;
using namespace std;
int main()
{
int t;
while(cin>>t)
{
int ans = 0;
int a;
while(t--)
{
cin>>a;
while(a)
{
if(a%256=='a')
ans++;
a>>=8;
}
}
cout<<ans<<endl;
}
return 0;
}
每八位是一个数字 ,统计一下有几个97;
//
// main.cpp
// 160929
//
// Created by 刘哲 on 17/5/30.
// Copyright © 2016年 my_code. All rights reserved.
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <bitset>
#include <stack>
#include <stdlib.h>
#define lowbit(x) (x&-x)
typedef long long ll;
using namespace std;
int main()
{
int t;
while(cin>>t)
{
int ans = 0;
int a;
while(t--)
{
cin>>a;
while(a)
{
if(a%256=='a')
ans++;
a>>=8;
}
}
cout<<ans<<endl;
}
return 0;
}
相关文章推荐
- HDU 2575 Count Problem (水题)
- HDU 1086 You can Solve a Geometry Problem too(水题,判断线段相交)
- HDU 1016 Prime Ring Problem(水题纯暴)
- HDU 5170 GTY's math problem 水题
- HDU 5443 The Water Problem(水题 找区间最大值)——2015 ACM/ICPC Asia Regional Changchun Online
- hdu 5686 Problem B【水题】
- HDU 5443 The Water Problem(线段树水题)
- hdu 4716 A Computer Graphics Problem(水题)
- HDU 1032 The 3n + 1 problem (水题)
- [HDU-5979] [Problem I]水题(16大连站)计算几何
- [水题] hdu 5349 MZL's simple problem
- HDU 1001 Sum Problem(水题)
- HDU1022 Train Problem I【堆栈+STL+水题】
- HDU 4716 A Computer Graphics Problem (水题)
- HDU 4143 A Simple Problem(数论-水题)
- HDU 4143 A Simple Problem(数论-水题)
- hdu 2055 An easy problem (水题)
- hdu 1032 The 3n + 1 problem(水题)
- HDU 1032 The 3n + 1 problem 【水题】
- HDU 5475 An easy problem(网络赛水题)