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.


解题说明:此题是一道模拟题,用X加上X每一位的每一位得到这个数,逆推所有的x

#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;

int main()
{
	long n;
	long i, t, sum;
	int flag = 0;
	int a[100];
	scanf("%ld", &n);
	for (i = n - 100; i<n; ++i)
	{
		sum = i;
		t = i;
		while (t>0)
		{
			sum += t % 10;
			t /= 10;
		}
		if (sum == n)
		{
			flag++;
			a[flag] = i;
		}
	}
	printf("%d\n", flag);
	for (i = 1; i <= flag; i++)
	{
		printf("%ld\n", a[i]);
	}
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Key Features This is the first book to guide educators step by step through teaching with Google Classroom It's focused on you, your students, and providing great learning experiences easily It's easy to follow, with everything you need to get started and keep going even if you're not a technology fan Book Description Google Classroom helps teachers bring their work online. According to Google Trends, it's already bigger than Moodle after barely a year in the wild. This book is a complete start-to-finish guide for teachers using Google Classroom for the first time. It explains what Google Classroom is, what it can do, how to set it up, and how to use it to enhance student learning while making your life as a teacher easier. It shows you how to place resources and activities online, gather assignments, and develop group and individual activities. It's not just a manual, you'll also discover inspiring, easy ways to put Google Classroom to work for you and your class. What you will learn Create a Google Classroom and add customized information for each individual class Add students to a Google Classroom Send announcements and questions to students Create, distribute, collect, and grade assignments through Google Classroom Add events to and share a Google Classroom's calendar with parents Reuse posts, archive classrooms, and perform other administrative tasks in Google Classroom Use Google Docs Add-ons, and Google Chrome Webstore Apps and Extensions to enhance assignments Set up Google Classroom's mobile app About the Author Michael Zhang is a certified trainer for Google Apps for Education. Mike Zhang's post-secondary degree is in Education and he works within a school district in Canada. Therefore, he is in contact with a large population of teachers and often questions them regarding modern technologies within the classroom. Occasionally, he teaches classes as well and has opportunities to use Google Apps for education for a consistent set of students. Furthermore, he facilitates technology training at the University of Alberta in Google Apps. This makes him able to communicate the technology in a comprehensible manner to his readers. Table of Contents Chapter 1: Getting to Know Google Classroom Chapter 2: Inviting Students to Their Virtual Classroom Chapter 3: Sending Your First Announcement Chapter 4: Starting an Online Discussion with Questions Chapter 5: Handing out and Taking in Assignments Chapter 6: Grading Written Assignments in a Flash Chapter 7: Google Forms for Multiple Choice and Fill-in-the-blank Assignments Chapter 8: Keeping Parents in the Loop Chapter 9: Customizing to Your Subject

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值