PE刷题记
Posted zwfymqz
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PE刷题记相关的知识,希望对你有一定的参考价值。
最喜欢做这种很有意思的数学题了虽然数学很垃圾
但是这个网站的提交方式好鬼畜啊qwq
1.
直接枚举
2.
直接枚举
3.
$sqrt(n)$枚举
#include<cstdio> #include<vector> #include<set> #include<algorithm> #define sit #define LL long long using namespace std; const int MAXN = 1e6 + 10; inline int read() { char c = getchar(); LL x = 0, f = 1; while(c < ‘0‘ || c > ‘9‘) {if(c == ‘-‘) f = -1; c = getchar();} while(c >= ‘0‘ && c <= ‘9‘) x = x * 10 + c - ‘0‘, c = getchar(); return x * f; } LL ans = 600851475143; int main() { LL out = 0; for(LL i = 2; i * i <= ans; i++) { if(ans % i == 0) { out = max(out, i); while(ans % i == 0) ans /= i; } } printf("%I64d", max(out, ans)); return 0; } /* */
4.
暴力枚举
#include<cstdio> #include<vector> #include<set> #include<algorithm> #define sit #define LL long long using namespace std; const int MAXN = 1e6 + 10; inline int read() { char c = getchar(); LL x = 0, f = 1; while(c < ‘0‘ || c > ‘9‘) {if(c == ‘-‘) f = -1; c = getchar();} while(c >= ‘0‘ && c <= ‘9‘) x = x * 10 + c - ‘0‘, c = getchar(); return x * f; } int ans; int main() { int ans = 0; for(int i = 100; i <= 999; i++) { for(int j = 100; j <= 999; j++) { int x = i * j; int a[20], tot = 0, flag = 0; while(x) a[++tot] = x % 10, x /= 10; for(int k = 1; k <= tot; k++) if(a[k] != a[tot - k + 1]) {flag = 1; break;} if(flag == 0) ans = max(ans, i * j); } } printf("%d", ans); return 0; } /* */
以上是关于PE刷题记的主要内容,如果未能解决你的问题,请参考以下文章
Go语言学习基础刷题记(Golang roadmap)2021-07-13