SGU107 水题 Easy

来源:互联网 发布:淘宝找不到卖家中心 编辑:程序博客网 时间:2024/04/30 00:26

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;}


0 0