CF 441 div1a

题目:

A. Classroom Watch
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

Eighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered Vova that n is the answer to the arithmetic task for first-graders. In the textbook, a certain positive integer x was given. The task was to add x to the sum of the digits of the number x written in decimal numeral system.

Since the number n on the board was small, Vova quickly guessed which x could be in the textbook. Now he wants to get a program which will search for arbitrary values of the number n for all suitable values of x or determine that such x does not exist. Write such a program for Vova.
Input

The first line contains integer n (1 ≤ n ≤ 109).
Output

In the first line print one integer k — number of different values of x satisfying the condition.

In next k lines print these values in ascending order.
Examples
Input

21

Output

1
15

Input

20

Output

0

Note

In the first test case x = 15 there is only one variant: 15 + 1 + 5 = 21.

In the second test case there are no such x.

题意:
给你一个数n,让你找出所有数他本身加上他各位上的数等于n.
思路:
这题说实话没有想到,一开始以为打表,但并没有发现什么规律,思路是因为数的范围是10^10,所以一个数最大是999999999.
代码:

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<string.h>
using namespace std;
typedef long long LL;
vector<LL>ans;
LL n;
int main()
{
    cin >> n;
    for (LL i = max(n - 100,(LL)0); i <= n; i++)
    {
        LL temp = i;
        LL a = temp;
        while (temp)
        {
            a += temp % 10;
            temp /= 10;
        }
        if (a == n)
            ans.push_back(i);
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++)
        cout << ans[i] << ' ';
    cout << endl;
    return 0;
}
wxh@wxh-dt:~/tplink/PLATFORM/sdk/qca$ git log commit 4ef0453231b2bed4100ad7d89cf8e3cf58dcd0eb (HEAD -> 1204_SPF_11.3_CS-vine4_rrm) Author: 杨世彪 <yangshibiao@tp-link.com.hk> Date: Tue May 27 17:23:53 2025 +0800 Revert "[问题]:1.【RRM】11.4驱动用do_div做除法得到的信道利用率和底噪有误" This reverts commit 8f8d9fa755d1d2c2363d01cf22d6a3e88cbc9f06. Reason for revert: 进行专项提测,暂时回退提交 Change-Id: I56d2f11b03faa4f86cbcfcea2aacbfec7e71e629 commit 5bf571e1c8732041a4cad847bab3fc8056362c8a Author: yangshibiao <yangshibiao@tp-link.com.hk> Date: Sun May 18 17:45:09 2025 -0700 [问题]:1.【RRM】11.4驱动用do_div做除法得到的信道利用率和底噪有误 2.纠正错用do_div做除法的代码 [参考提交]:http://gerrit.ep.tp-link.com/c/SMB/EAP/SMB_QCA_SDK/+/185984 [原因]:do_div返回值是余数 [解决]:1.对底噪之和取反后作为参数传入qdf_do_div做除法,获取到的结果再取反即可获得底噪均值 2.应该使用函数qdf_do_div做除法 Change-Id: I72a90e57e597690be3b1f8ffab5ba7b9ed649ee6 commit dcb02cbf11501a6c6c724af3c412f944e4f49dbc Author: yangshibiao <yangshibiao@tp-link.com.hk> Date: Fri May 16 00:37:21 2025 -0700 [问题]:【RRM】11.4驱动64位除法没有使用函数do_div [参考提交]:http://gerrit.ep.tp-link.com/c/SMB/EAP/SMB_QCA_SDK/+/185789 [原因]:11.4驱动不能直接做除法,需要使用函数do_div [解决]:使用函数do_div做除法 Change-Id: I7d34bd13c49a1a453f8793b3d020288d99cfd40b commit 339233b1249156d41bb01d55711f23f00ceea9f3 Author: wangxinhua <wangxinhua@tp-link.com.h> Date: Thu Dec 4 15:20:38 2025 +0800 [问题]:【RRM】背景扫描优化-SDK改动 1.对多轮背景扫描获取的信道利用率取平均值 2.对多轮背景扫描获取的底噪取平均值,仅对有效结果取均值,剔除无效值0dBm和-254dBm 3.新增用于清除背景扫描保存在驱动的信道利用率和底噪结果的ioctl接口 [参考提交]:http://gerrit.ep.tp-link.com/c/SMB/EAP/SMB_QCA_SDK/+/185595 [原因]: [解决]: Change-Id: I8df2d84a415cfbe7a704d9b675a2debcf611172c 我怎么把我本地的第一个提交和第二个的提交删掉
12-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值