题目链接:http://codeforces.com/problemset/problem/919/B

AC代码:

#include<cstdio>

using namespace std;

//对全局变量或者对于一个或多个函数来说是全局的变量的时候,要注意上次用完该变量后变量的值,看其是否需要进行初始化。

int main() {
int k, index = 1, stemp, s = 19;
int arr[10005];
int sum = 0;
while (scanf("%d", &k) != EOF) {
while (index <= k) {
stemp = s;
while (stemp != 0) {
sum += stemp % 10;
stemp /= 10;
}
if (sum == 10)
arr[index++] = s;
sum = 0;
s += 9;
}
printf("%d\n", arr[k]);
index = 1; //注意
s = 19; //注意
}
return 0;
}

[CodeForces - 919B] Perfect Number的更多相关文章

  1. Codeforces Round #460 (Div. 2)-B. Perfect Number

    B. Perfect Number time limit per test2 seconds memory limit per test256 megabytes Problem Descriptio ...

  2. Codeforces 919 B. Perfect Number

      B. Perfect Number   time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  3. Codeforces Round #460 (Div. 2) B Perfect Number(二分+数位dp)

    题目传送门 B. Perfect Number time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  4. Codeforces 55D Beautiful Number

    Codeforces 55D Beautiful Number a positive integer number is beautiful if and only if it is divisibl ...

  5. 507. Perfect Number

    We define the Perfect Number is a positive integer that is equal to the sum of all its positive divi ...

  6. [LeetCode] Perfect Number 完美数字

    We define the Perfect Number is a positive integer that is equal to the sum of all its positive divi ...

  7. [Swift]LeetCode507. 完美数 | Perfect Number

    We define the Perfect Number is a positive integer that is equal to the sum of all its positive divi ...

  8. LeetCode算法题-Perfect Number(Java实现)

    这是悦乐书的第249次更新,第262篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第116题(顺位题号是507).我们定义Perfect Number是一个正整数,它等于 ...

  9. 507. Perfect Number 因数求和

    [抄题]: We define the Perfect Number is a positive integer that is equal to the sum of all its positiv ...

随机推荐

  1. Python -- print(dataframe)时,省略部分列。

    import pandas as pd # 导入后加入以下列,再显示时显示完全. pd.set_option('display.max_rows',500) pd.set_option('displa ...

  2. C# CheckBox与RadioButton

    通常RadioBox称为单选按钮,CheckBox称为多选按钮,这两个控件都是从ButtonBase类中派生,可以将其视为按钮. 多个checkBox之间的选择是互相独立的,互补影响.多个RadioB ...

  3. limit小结

    1. Limit接受一个或两个数字参数.参数必须是一个整数常量.如果给定两个参数,第一个参数指定第一个返回记录行的偏移量,第二个参数指定返回记录行的最大数目. 2. 初始记录行的偏移量是 0(而不是 ...

  4. activemq消息队列的使用及应用docker部署常见问题及注意事项

    activemq消息队列的使用及应用docker部署常见问题及注意事项 docker用https://hub.docker.com/r/rmohr/activemq/配置在/data/docker/a ...

  5. linux下mysql 8.0忘记密码后重置密码

    1://免密码登陆 找到mysql配置文件:my.cnf, 在[mysqld]模块添加:skip-grant-tables   保存退出: 2://使配置生效 重启mysql服务:  service ...

  6. tft屏图像文字一起显示

    2010-05-04 21:06:00 M16内部flash只有16k,要做数码相框,只能用usart通信了.明天继续研究.

  7. vue 加载更多

        <template>   <div>     <ul>       <li v-for="item in articles"> ...

  8. 金九银十跳槽季,程序员面试点解析之Java专场

    前言 近年来Java工程师这个岗位炙手可热,市场需求大,学习Java的人也越来越多,所以IT企业与求职者的选择都比较多,那么IT企业在面试时都会提哪些问题呢.下面为大家分享 Java高级工程师面试阿里 ...

  9. SSM整合Mybatis-Spring

    mybatis -Spring 整合 cn.kitty.bean public class Book { private int bookid; private String bookname; pr ...

  10. SpringMVC之数据绑定

    SpringMVC之数据绑定 #数据绑定:Spring MVC会根据客户端请求参数的不同,将请求信息以一定的方式转换并绑定 到控制器类中的方法参数上. #说明:这里的“以一定的方式”应该指的是什么?过 ...