Today SGU 5.3

SGU 107

The meaning of the question: Enter an N, indicating how many square numbers there are in the N-digit number. The last 9 digits of the number are 987654321

Harvest: hit the table, you find that the last digits of the result of multiplying numbers with the same digits are the same as the last digits of the two multiplied numbers. For example, 3416*8516 = 29090656, its last two digits are the same as The last two digits of 16*16=256 are the same as 56, then you find that 987654321 digits are 9 digits, and the 8 answers you preprocessed are 9 digits. You can see how many digits d=n-9 is, then it is 9 *8* (d bit 10) multiply, a for will do

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;++i)
typedef long long ll;

int main(){
    //for(ll i =2;i<=1e9;++i) if(i*i%mod==x) cout<<i<<" ";
    int n;
    scanf("%d",&n);
    if(n<9) return puts("0"),0;
    if(n==9) return printf("8"),0;
    int d = n - 9;
    printf("72");
    rep(i,1,d) printf("0");
    return 0;
}
View Code

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325247112&siteId=291194637
5.3