首页 > 代码库 > 6.28数论测试

6.28数论测试

技术分享

(hao.cpp/c/pas)

【问题描述】
从1− N中找一些数乘起来使得答案是一个完全平方数,求这个完全平方数
最大可能是多少。
【输入格式】
第一行一个数字N。
【输出格式】
一行一个整数代表答案对100000007取模之后的答案。
【样例输入】
7
【样例输出】
144
【样例解释】
但是塔外面有东西。
【数据规模与约定】
对于20%的数据,\begin{equation*}1\leq N\leq 100 \end{equation*}。
对于50%的数据,\begin{equation*}1\leq N\leq 5000 \end{equation*}。
对于70%的数据,\begin{equation*}1\leq N\leq 10^5 \end{equation*}。
对于100%的数据,\begin{equation*}1\leq N\leq 5\times 10^6 \end{equation*}。

思路分析:

1.完全平方数的性质:

\begin{equation*}对于任意完全平方数n,总能写成n=a^b\cdot c^d\cdot\cdots y^z(a, c, f, \cdots , y均为质数,b, d, e, \cdots , z 均为偶数)的形式.\end{equation*}

AC代码:

技术分享
  1 #include<cstdio>  2 #define _____________ 5000000  3 #define ____________ 100000007  4 #define _____________________ for  5 #define ______________________ while  6 #define _______________________ if  7 #define ________________________ return  8 #define _________________________ main  9 #define __________________________ freopen 10 #define ___________________________ "hao.in" 11 #define ____________________________ "r" 12 #define _____________________________ stdin 13 #define ______________________________ "hao.out" 14 #define _______________________________ "w" 15 #define ________________________________ stdout 16 #define _________________________________ scanf 17 #define __________________________________ printf 18 #define ___________________________________ "%d" 19 #define ____________________________________ { 20 #define _____________________________________ } 21 #define ______________________________________ , 22 #define _______________________________________ ; 23 #define ________________________________________ [ 24 #define _________________________________________ ] 25 #define __________________________________________ ( 26 #define ___________________________________________ = 27 #define ____________________________________________ ) 28 #define _____________________________________________ 1 29 #define ______________________________________________ ++ 30 #define _______________________________________________ 2 31 #define ________________________________________________ * 32 #define _________________________________________________ % 33 #define __________________________________________________ & 34 #define ___________________________________________________ / 35 #define ____________________________________________________ <= 36 #define _____________________________________________________ += 37 #define ______________________________________________________ >>= 38 #define _______________________________________________________ + 39 #define ________________________________________________________ /= 40 #define _________________________________________________________ 0 41 #define __________________________________________________________ ! 42 #define ___________________________________________________________ long 43 #define ____________________________________________________________ typedef 44 #define _____________________________________________________________ int 45 #define ______________________________________________________________ void 46 #define _______________________________________________________________ using 47 #define ________________________________________________________________ namespace 48 #define _________________________________________________________________ std 49 #define __________________________________________________________________ +=  50 _______________________________________________________________ ________________________________________________________________ _________________________________________________________________ _______________________________________ 51 ____________________________________________________________ ___________________________________________________________ ___________________________________________________________ ____________________ _______________________________________ 52 ____________________________________________________________ _____________________________________________________________ ___________________ _______________________________________ 53 ____________________________________________________________ ______________________________________________________________ __________________ _______________________________________ 54 ___________________ _________ ______________________________________ ___ _______________________________________ 55 ___________________ ____ ________________________________________ _____________ _________________________________________ _______________________________________ 56 ___________________ _ ________________________________________ _____________ _________________________________________ _______________________________________ 57 ___________________ ___________ ________________________________________ _____________ _________________________________________ _______________________________________ 58 ____________________ _____ ___________________________________________ _____________________________________________ _______________________________________ 59 __________________ ______ __________________________________________ ____________________________________________ 60 ____________________________________ 61     _____________________ __________________________________________ ___________________ _______ ___________________________________________ _______________________________________________ _______________________________________ _______ ____________________________________________________ _________ _______________________________________ _______ ______________________________________________ ____________________________________________ 62     _______________________ __________________________________________ __________________________________________________________ ____ ________________________________________ _______ _________________________________________ ____________________________________________ 63     ____________________________________ 64         _ ________________________________________ ______________________________________________ ___ _________________________________________ ___________________________________________ _______ _______________________________________ 65         _____________________ __________________________________________ ___________________ ________ ___________________________________________ _______ _______________________________________________________ _______ _______________________________________ ________ ____________________________________________________ _________ _______________________________________ ________ __________________________________________________________________ _______ ____________________________________________ 66         ____ ________________________________________ ________ _________________________________________ ___________________________________________ _____________________________________________ _______________________________________ 67     _____________________________________ 68 _____________________________________ 69 __________________ ______________ __________________________________________ ____________________________________________ 70 ____________________________________ 71     _____________________ __________________________________________ ___________________ _______ ___________________________________________ _____________________________________________ _______________________________________ _______ ____________________________________________________ ___ _______________________________________ _______ ______________________________________________ ____________________________________________ 72     ____________________________________ 73         ____________________ __________ ___________________________________________ _________ _______________________________________ 74         ______________________ __________________________________________ __________ ____________________________________________ 75         ____________________________________ 76             ___________ ________________________________________ _______ _________________________________________ _____________________________________________________ __________ ___________________________________________________ _ ________________________________________ _______ _________________________________________ _______________________________________ 77             __________ ________________________________________________________ _ ________________________________________ _______ _________________________________________ _______________________________________ 78         _____________________________________ 79     _____________________________________ 80 _____________________________________ 81 ____________________ _______________ __________________________________________ ____________________ _ ______________________________________ ____________________ __ ____________________________________________ 82 ____________________________________ 83     ____________________ __________ ___________________________________________ _____________________________________________ _______________________________________ 84     ______________________ __________________________________________ __ ____________________________________________ 85     ____________________________________ 86         _______________________ __________________________________________ __ __________________________________________________ _____________________________________________ ____________________________________________ 87         __________ ___________________________________________ __________ ________________________________________________ _ _________________________________________________ ____________ _______________________________________ 88         _ ___________________________________________ _ ________________________________________________ _ _________________________________________________ ____________ _______________________________________ 89         __ ______________________________________________________ _____________________________________________ _______________________________________ 90     _____________________________________ 91     ________________________ __________ _________________________________________________ ____________ _______________________________________ 92 _____________________________________ 93 ___________________ _________________________ __________________________________________ ____________________________________________ 94 ____________________________________ 95     __________________________ __________________________________________ ___________________________ ______________________________________ ____________________________ ______________________________________ _____________________________ ____________________________________________ _______________________________________ 96     __________________________ __________________________________________ ______________________________ ______________________________________ _______________________________ ______________________________________ ________________________________ ____________________________________________ _______________________________________ 97     _________________________________ __________________________________________ ___________________________________ ______________________________________ __________________________________________________ _________ ____________________________________________ _______________________________________ 98     ______ __________________________________________ ____________________________________________ _______________________________________ 99     ______________ __________________________________________ ____________________________________________ _______________________________________100     _____________________ __________________________________________ ___________________ _______ ___________________________________________ _____________________________________________ _______________________________________ _______ ____________________________________________________ ___ _______________________________________ _______ ______________________________________________ ____________________________________________101         _____ ___________________________________________ __________________________________________ _____ ________________________________________________ _______________ __________________________________________ _ ________________________________________ _______ _________________________________________ ______________________________________ ___________ ________________________________________ _______ _________________________________________ ___________________________________________________ _______________________________________________ ________________________________________________ _______________________________________________ ____________________________________________ _________________________________________________ ____________ ____________________________________________ _________________________________________________ ____________ _______________________________________102     __________________________________ __________________________________________ ___________________________________ ______________________________________ _____ ____________________________________________ _______________________________________103     ________________________ _________________________________________________________ _______________________________________104 _____________________________________
code

 (以上代码纯属本人因为上午电脑蓝屏重启导致代码+2K注释丢失后为报复社会而写,没有可读性,请直接忽略).

6.28数论测试