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 ...
随机推荐
- JavaScript处理HTML DOM
本来只想好好写一篇博文,最后弄到好像重构一样了,越做越不满意,先这样吧:) HTML DOM - JavaScript处理HTML DOM 获取HTML元素 改变HTML元素 增删HTML元素 添加事 ...
- In Depth : Android Boot Sequence / Process
In Depth : Android Boot Sequence / Process What happened when I press power on button in my Android ...
- WampServer下如何实现多域名配置
原文:WampServer下如何实现多域名配置 之前在学习跨域的时候,我写过一篇叫做WampServer下使用多端口访问的文章,默认的 localhost 采用的是 80 端口,能使用多端口访问的核心 ...
- 在chart上加入一条指示线
原文 http://hi.baidu.com/fuwei_bj/item/7e576410e970683db831801a <mx:AreaChart width="521" ...
- UVA1292-----Strategic game-----树形DP解决树上的最小点覆盖问题
本文出自:http://blog.csdn.net/dr5459 题目地址: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&a ...
- 使用kd-tree加速k-means
0.目录 前置知识 思路介绍 详述 1 确定h的中心点 2 算法步骤 java实现 1.前置知识 本文内容基于<Accelerating exact k-means algorithms wit ...
- 在centos中添加开机自启动服务
将服务的shell脚本添加到/etc/rc.d的rc.local文件的最后面,需要在服务名称的前面加上其路径. 例如我要将httpd添加到开机自启动中,需要在rc.local添加如下代码 /usr/s ...
- <select>标签后循环加入选项<option>——jquery
if (data.ReplaceDataFields != null) { $.each(data.ReplaceDataFields, function (i, item) { ...
- OceanBase中主备Rootserver如何管理切换
主RootServer会不断给备RootServer发送lease.被RootServer收到该lease后会保存到几个变量中: int ObCheckRunnable::renew_lease(co ...
- 使用Vitamio打造自己的Android万能播放器(6)——在线播放(播放列表)
前言 新版本的VPlayer由设计转入开发阶段,预计开发周期为一个月,这也意味着新版本的Vitamio将随之发布,开发者们可以和本系列文章一样,先开发其他功能.本章内容为"在线视频播放列表& ...