【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 ...
随机推荐
- 【html】【19】高级篇--大事件时间轴
下载: http://sc.chinaz.com/jiaoben/131112181390.htm 其它: http://sc.chinaz.com/tag_jiaoben/shijianzhou.h ...
- 为 Date 对象添加 ago 属性
/* * 此处,__defineGetter__与__defineSetter__相当于C#实体中类中的get与set **/ Date.prototype.__defineGetter__('ago ...
- Sql 解释
SQL(Structured Query Language) 结构化查询语言,虽然是查询语言,也是一种编程语言,但是执行查询操作. 根据数据的操作对象,可以将SQL语句分为几类. DDL(Data D ...
- OpenJudge/Poj 2027 No Brainer
1.链接地址: http://bailian.openjudge.cn/practice/2027 http://poj.org/problem?id=2027 2.题目: 总Time Limit: ...
- Ajax跨域请求——PHP服务端处理
header('Access-Control-Allow-Origin:*'); // 响应类型 header('Access-Control-Allow-Methods:POST'); // 响应头 ...
- windows 8.1 pro X64安装中断
用PE安装windows 8.1 pro X64 ISO镜像,快完成的时候卡在蓝色背景那不动了,等待了大概30min强制重启了. 奇怪的是,居然进去了,不过很慢.配置了一段时间终于看到桌面了,关机,失 ...
- 客户端(android,ios)与服务器通信
android,ios客户端与服务器通信为了便于理解,直接用PHP作为服务器端语言 其实就是一个 http请求响应的过程序,先从 B/S模式说起浏览器发起http请求,服务器响应请求,并把数据返回给浏 ...
- php 命名空间(要求php5.3以上)
要求php5.3以上 <?phpnamespace test;// 命名空间与目录类似功能,也可定义子命名空间,用分层的方式定义:/*namespace mydir\ok\project; 在声 ...
- javascript检测是否安装了flash
检测是否安装了flash function flashChecker() { var hasFlash = 0; //是否安装了flash var flashVersion = 0; //flash版 ...
- div+css实现未知宽高元素垂直水平居中
div+css实现未知宽高元素垂直水平居中.很多同学在面试的时候都会遇到这样的问题:怎么用div+css的方法实现一个未知宽高的弹出框(或者图片)垂直水平居中??如果用JS的话就好办了,但是JS的使用 ...