Problem: For given number N you must output amount of N-digit numbers, such, that last digits of their square is equal to 987654321.
解法:编个程找规律,然后直接写。
Solution: Write a program to find the rules then you will know how to deal with it.
#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
int n;
int main() {
while (~scanf("%d",&n)) {
if (n<=8) printf("0");
else if (n==9) printf("8");
else {
printf("72");
n -= 10;
while (n--) printf("0");
}
printf("\n");
}
return 0;
}