poj2196---Specialized Four-Digit Numbers
#include <stdio.h>
#include <stdlib.h> int main()
{
int i,sum,sumOfH,sumOfd,tmp1,tmp2,tmp3;
for(i=;i<;i++)
{
sum=;
sumOfd=;
sumOfH=;
tmp1=i;tmp2=i;tmp3=i;
while(tmp1)
{
sumOfd+=(tmp1 % );
tmp1/=;
}
while(tmp2)
{
sumOfH += (tmp2 % );
tmp2/=;
}
while(tmp3)
{
sum+=(tmp3 % );
tmp3/=;
}
if(sum==sumOfd && sumOfd==sumOfH)
{
printf("%d\n",i);
}
}
return ;
}
wa2次,每注意要比较的是哪几个值相等
poj2196---Specialized Four-Digit Numbers的更多相关文章
- [Swift]LeetCode902. 最大为 N 的数字组合 | Numbers At Most N Given Digit Set
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
- 902. Numbers At Most N Given Digit Set
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
- LeetCode902. Numbers At Most N Given Digit Set
题目: We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. ...
- [LeetCode] 902. Numbers At Most N Given Digit Set 最大为 N 的数字组合
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
- 利用Python【Orange】结合DNA序列进行人种预测
http://blog.csdn.net/jj12345jj198999/article/details/8951120 coursera上 web intelligence and big data ...
- PAT/进制转换习题集
B1022. D进制的A+B (20) Description: 输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. Input: ...
- [转]http://lua-users.org/wiki/LpegTutorial
Simple Matching LPeg is a powerful notation for matching text data, which is more capable than Lua s ...
- FZU 2215 Simple Polynomial Problem(简单多项式问题)
Description 题目描述 You are given an polynomial of x consisting of only addition marks, multiplication ...
- Problem K 栈
Description A math instructor is too lazy to grade a question in the exam papers in which students a ...
- PAT 1019
1019. General Palindromic Number (20) A number that will be the same when it is written forwards or ...
随机推荐
- Java-Poi 读取excel 数据
一直想着使用java操作excel,但有时各种原因一直没有实现.由于工作无意间做了个其他demo,为了进一步发散就涉及到了使用excel,为此开始正式接触POI,虽然限制不是很了解POI,但是通过查阅 ...
- vim下高级操作以及文本替换命令
关于vim的一些基本和高级的操作 可参考下面的链接. http://coolshell.cn/articles/5426.html 在使用vim编辑文本的时候涉及到批量替换文本内容 :s/vivian ...
- layerX offsetX pageX
offsetX/offsetY:相对于当前元素的位移x/y:相对于当前座标系的位移,但是IE常常搞错当前座标系layerX/layerY:相对于当前座标系的位移pageX/pageY:相对于网页的位移 ...
- java--工具方法
根据时间戳得到具体的时间: public static void main(String[] args) { SimpleDateFormat sdf = new SimpleDateFormat(& ...
- tracker-store and tracker-miner-fs eating up my CPU on every startup
Tracker is a synergy of technologies that are designed to provide a highly sophisticated, innovative ...
- mysql入库中文乱码问题
mysql> show variables like '%char%';+--------------------------+----------------------------+| Va ...
- android开发关于和使用本机内存、内置存储卡和外置存储卡 (转)
转自:http://www.2cto.com/kf/201304/204729.html 关于android存储器简介: android开发常常需要涉及数据缓存,这就 ...
- Mirantis Fuel fundations
Mirantis Nailgun is the most important service a RESTful application written in Python that contains ...
- Windows SVN变更发送邮件通知(JAVA实现)
之前有过一篇python的实现http://blog.csdn.net/wiker_yong/article/details/10334967 1,新增文件post-commit.bat 内容: re ...
- 解密yii中CModule::_components和CModule::_componentConfig
array CModule::_components 所有组件对象(CComponent的子类)将作为键值存在该数组中, 键名是定义该组件时使用的键名.例如: protected function r ...