数学基础
数学基础
jpphy0
算法是存在的
展开
-
hdu 1098 Ignatius‘s puzzle
Ignatius’s puzzle == 暴力枚举== #include <bits/stdc++.h> using namespace std; int vis[65]; int f(int x, int k, int a){ int res = 0, tmp = x; for(int i = 2; i <= 5; i++) tmp = tmp*x%65; res = (res+13*tmp)%65; for(int i = 6; i <= 13;原创 2021-03-26 14:32:25 · 142 阅读 · 0 评论 -
hdu 1060 Leftmost Digit
Leftmost Digit #include <bits/stdc++.h> using namespace std; // 对数logarithm/真数antilogarithm/底base // 首数(characteristic)/尾数(mantissa) int solve(int x){ double anti = x*log10(x); return pow(10, anti - floor(anti)); } int main(){ int n, T;原创 2021-03-26 08:20:02 · 98 阅读 · 0 评论 -
hdu 2899 Strange fuction
Strange fuction #include <bits/stdc++.h> using namespace std; //F(x) = 6*x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100) #define F(x, y) (x*(x*(x*(x*(x*(x*(6*x+8)))+7)+5)-y)) double solve(double l, double r, double y){ double lm, rm; while(r -原创 2021-03-25 21:12:21 · 78 阅读 · 0 评论 -
hdu 2199 Can you solve this equation?
Can you solve this equation? 二分 #include <bits/stdc++.h> using namespace std; // 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 #define f(x) (x*(x*(x*(x*8+7)+2)+3)+6) double binSearch(double l, double r, double val){ double mid; while(r - l > 1e-7){原创 2021-03-25 20:30:28 · 105 阅读 · 0 评论 -
hdu 2035 人见人爱A^B
人见人爱A^B #include <bits/stdc++.h> using namespace std; #define LL long long int qp(LL a, LL b, int mod){ int res = 1; while(b){ if(b&1) res = res*a%mod; a = a*a%mod; b >>= 1; } return res; } int main()原创 2021-03-24 21:03:59 · 95 阅读 · 0 评论 -
hdu 1097 A hard puzzle
A hard puzzle #include <bits/stdc++.h> using namespace std; int f[10][6] = {{1,0,0},{1,1},{1,2,4,8,6,2},{1,3,9,7,1},{1,4,6,4}, {1,5,5},{1,6,6},{1,7,9,3,1},{1,8,4,2,6,8},{1,9,1}}; int c[10] = {1,1,4,4,2,1,1,4,4,2}; int s[10] = {1,0,1,0,1,1,1,0,1,0原创 2021-03-24 14:43:22 · 121 阅读 · 0 评论 -
hdu 1021 Fibonacci Again
Fibonacci Again #include <bits/stdc++.h> using namespace std; int f[15] = {1, 2, 0, 2, 2, 1, 0, 1, 1, 2}; int main(){ int n; while(scanf("%d", &n) == 1){ printf("%s\n", f[n%8]==0?"yes":"no"); } return 0; }原创 2021-03-24 14:13:58 · 92 阅读 · 0 评论 -
hdu 1019 Least Common Multiple
Least Common Multiple #include <bits/stdc++.h> using namespace std; int gcd(int x, int y){ return y ? gcd(y, x % y) : x; } int lcm(int x, int y){ return x/gcd(x,y)*y; } int main(){ int T, m, x, ans; scanf("%d", &T); while(T--)原创 2021-03-24 11:31:49 · 102 阅读 · 0 评论 -
hdu 1108 最小公倍数
最小公倍数 #include <bits/stdc++.h> using namespace std; int gcd(int x, int y){ return y ? gcd(y, x % y) : x; } int lcm(int x, int y){ return x/gcd(x,y)*y; } int main(){ int x, y; while(scanf("%d %d", &x, &y) == 2){ printf(原创 2021-03-24 11:26:47 · 75 阅读 · 0 评论 -
hdu 1001 Sum Problem
Sum Problem 一、循环 #include <bits/stdc++.h> using namespace std; int n; int main(){ int ans; while(scanf("%d", &n) == 1){ ans = 0; for(int i = 1; i <= n; i++){ ans += i; } printf("%d\n\n", ans)原创 2021-03-24 11:18:49 · 72 阅读 · 0 评论