HDU 2568.前进
2018-01-09 23:16
253 查看
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2568
AC代码(C++):
总结: 水题.
AC代码(C++):
#include <iostream> #include <queue> #include <set> #include <string> #include <algorithm> #include <string.h> #include <math.h> #define INF 0x3f3f3f3f #define eps 1e-8 typedef unsigned long long ULL; using namespace std; int n; int main() { int t; cin >> t; while (t--) { cin >> n; int cnt = 0; while (n != 0) { if (n % 2 == 0)n /= 2; else { n--; cnt++; } } cout << cnt << endl; } //system("pause"); }
总结: 水题.
相关文章推荐
- hdu-2568-前进
- HDU 2568 前进
- HDU 2568 前进
- HDU-2568-前进
- HDU--2568前进【水题】
- HDU 2568 前进 (递归+模拟两种方式)
- HDU 2568 前进
- HDU 2568 前进
- HDOJ/HDU 2568 前进(简单题)
- hdu 2568 前进
- HDOJ/HDU 2568 前进(简单题)
- 前进 2568
- hdoj 2568 前进
- HDOJ2568 ( 前进 ) 【切水题,很欢乐~】
- HDU 2568
- hdu 2568
- 【hdu - 2568】ACM程序设计期末考试081230
- HDU 2568 前进
- HDOJ 2568 前进(水)
- hdu 2568