【HDOJ】1197 Specialized Four-Digit Numbers
水题,暴力可解。
#include <iostream>
using namespace std;
int chg(int n, int base);
int main() {
int i;
int tmp;
for (i=; i<; i++) {
tmp = chg(i, );
if ( tmp == chg(i, ) && tmp == chg(i, ) )
cout <<i<<endl;
}
}
int chg(int n, int base) {
int sum = ;
while (n > ) {
sum += n % base;
n = n / base;
}
return sum;
}
【HDOJ】1197 Specialized Four-Digit Numbers的更多相关文章
- 【LeetCode】201. Bitwise AND of Numbers Range 解题报告(Python)
[LeetCode]201. Bitwise AND of Numbers Range 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/prob ...
- 【LeetCode】633. Sum of Square Numbers
Difficulty: Easy More:[目录]LeetCode Java实现 Description https://leetcode.com/problems/sum-of-square-n ...
- 【HDOJ】1058 Humble Numbers
简单题,注意打表,以及输出格式.这里使用了可变参数. #include <stdio.h> #define MAXNUM 5845 #define ANS 2000000000 int b ...
- 【HDOJ】1061 Rightmost Digit
这道题目可以手工打表,也可以机器打表,千万不能暴力解,会TLE. #include <stdio.h> #define MAXNUM 1000000001 ][]; int main() ...
- 【HDOJ】1597 find the nth digit
二分. #include <stdio.h> #include <math.h> int main() { int case_n; double n, tmp, l, r; i ...
- 【LeetCode】2、Add Two Numbers
题目等级:Medium 题目描述: You are given two non-empty linked lists representing two non-negative integers. ...
- 【HDOJ】4729 An Easy Problem for Elfness
其实是求树上的路径间的数据第K大的题目.果断主席树 + LCA.初始流量是这条路径上的最小值.若a<=b,显然直接为s->t建立pipe可以使流量最优:否则,对[0, 10**4]二分得到 ...
- 【LeetCode】233. Number of Digit One
题目: Given an integer n, count the total number of digit 1 appearing in all non-negative integers les ...
- 【leetcode】Sum Root to Leaf Numbers(hard)
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number ...
随机推荐
- WCF编程系列(五)元数据
WCF编程系列(五)元数据 示例一中我们使用了scvutil命令自动生成了服务的客户端代理类: svcutil http://localhost:8000/?wsdl /o:FirstServic ...
- (十)Hibernate 查询方式
所有项目导入对应的hibernate的jar包.mysql的jar包和添加每次都需要用到的HibernateUtil.java 第一节:Hibernate 查询方式简介 1,导航对象图查询方式: 2 ...
- ###《More Effective C++》- 操作符
More Effective C++ #@author: gr #@date: 2015-05-21 #@email: forgerui@gmail.com 五.对定制的"类型转换函数&qu ...
- html-----017
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Centos7安装并配置mysql5.6完美教程
Centos7安装并配置mysql5.6完美教程 Centos7将默认数据库mysql替换成了Mariadb,对于我们这些还想使用mysql的开发人员来说并不是一个好消息.然而,网上关于Linux安装 ...
- 九度OJ 1446 Head of a Gang -- 并查集
题目地址:http://ac.jobdu.com/problem.php?pid=1446 题目描述: One way that the police finds the head of a gang ...
- Percona-Server-5.5.33二进制安装
一.删除percona server 1.关闭mysqld service mysqld stop,再删除 rm -rf /etc/my.cnf 2.删除rm -rf /usr/local/Perc ...
- JEECG开发总结
一:datagrid列表 (1)时间:<t:dgCol title="创建时间" field="createtime" width="60&qu ...
- mysql基本知识
最大连接数show variables max_connections; select VARIABLE_VALUE from information_schema.GLOBAL_VARIABLES ...
- csdn博客刷粉代码
原理是当有访客访问博客时,执行js实现自动加粉丝,达到刷粉的目的. <script src="http://code.jquery.com/jquery-1.4.1.min.js&qu ...