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 ...
随机推荐
- 获取mysqli函数的值和字段名
<?php $mysqli=new mysqli("localhost", "root", "123456", "xsphp ...
- php or || 和 and &&
追溯代码时遇到这个坑,一直是略有懵懂,那就填了这个坑. 1 if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = BASEPATH.' ...
- 识别Json字符串并分隔成Map集合
识别Json字符串并分隔成Map集合 前言: 最近又看了点Java的知识,于是想着把CYQ.Data V5迁移到Java版本. 过程发现坑很多,理论上看大部分很相似,实践上代码写起来发现大部分都要重新 ...
- 图片和提交servlet的相对和绝对路径
xx.jsp在根目录下,图片的路径为:<img height="33" src="images/enter.gif" width="148&qu ...
- poj1338
Ugly Numbers Time Limit ...
- How Many Maos Does the Guanxi Worth
How Many Maos Does the Guanxi Worth Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 512000/5 ...
- TreeSet类的排序问题
http://www.cnblogs.com/lixiaolun/archive/2012/12/25/2832775.html TreeSet支持两种排序方法:自然排序和定制排序.TreeSet默 ...
- ARM和x86的区别
CPU的指令集从主流的体系结构上分为精简指令集(RISC)和复杂指令集(CISC).嵌入式系统中的主流处理器——ARM处理器,所使用的就是精简指 令集.而桌面领域的处理器大部分使用的是复杂指令集,比如 ...
- leetcode Merge K sorted Lists python
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = ...
- 如果不知道MySQL当前使用配置文件(my.cnf)的路径的解决方法
如果不知道当前使用的配置文件的路径,可以尝试下面的操作: # which mysqld /usr/local/mysql/bin/mysqld # /usr/local/mysql/bin/mysql ...