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 ...
随机推荐
- 多主一从mysql replication同步表的大胆尝试.
能否将不同机器上的不同库中的表同步到同一个机器的同一个库中?表是不同的.而且对于slave这台机子来说,这些表只用来读. 同步不同库的表很简单了,用 replicate-do-table=db_n ...
- 在 Linux ubuntu 上安装 *.sh 文件
简单说来就两步: 增加可执行权限 执行 事情是这样的,打算在 ubuntu 上安装一个 NetBeans IDE 来学习 Java,但是下载下来的文件是 .sh 格式的.图形界面下右键没有执行的选项. ...
- Cocos2d-X学习之Ref类
先看看定义该类的头文件——CCRef.h /**************************************************************************** C ...
- VS2008下WinRar源码生成dll和 lib总结
WinRar官方提供了源码(http://www.rarlab.com/rar_add.htm):如果自己想要修改里面的内容就要重新生成DLL和LIB,我在网上找了很多资料都没有说得很清楚.花一两天的 ...
- WPF学习:绑定
原文 http://www.cnblogs.com/SouthAurora/archive/2010/06/30/1768464.html 一.绑定到元素对象 1.元素和元素(XAML.代码) 1.1 ...
- C++ 文件的复制、删除、重命名
一.文件的复制 #include <iostream>#include <fstream>using namespace std; int CopyFile(char *Sou ...
- PLA 多维情况下的vc维
对于d维的数据集,vc = d+1 证明: $vc \geq d+1$ : 存在d+1个点可以被H shatter 构造矩阵(注意加上$w_0$对应的$x_0$) 注意x可逆,构造$w=X^{-1 ...
- Java WebService把Date类型转换成XMLGregorianCalendar
JavaEE 的WebService中的Date类型在Web应用中调set方法的时候,默认情况下,JAXB将xsd:date, xsd:time, 和xsd:dateTime映射为XMLGregori ...
- Android UI SurfaceView的使用-绘制组合图型,并使其移动
绘制容器类: //图形绘制容器 public class Contanier { private List<Contanier> list; private float x=0,y=0; ...
- Redmine email配置
很简单,先安装sendmail apt-get install sendmail 然后在redmine目录的配置文件conf/configuration.yml中取消几行注释: # ==== Send ...