HRBUST
文章平均质量分 55
muczzcy
这个作者很懒,什么都没留下…
展开
-
HRBUST 1908 A+B+C 高精度加法
SOL:小学数学规则,模拟即可。 第一个常见的板子 (通用性较小) 5ms #include #include #define rep(i,n) for(i=1;i<=n;i++) using namespace std; const int maxn = 1000 + 10; char str1[maxn],str2[maxn],str3[maxn]; int i,len1,l原创 2013-12-17 00:08:33 · 658 阅读 · 0 评论 -
POJ 2142 The Balance
SOL : 扩展的欧几里德, ax+by==c x=x0+b/d*t; y=y0-a/d*t; 求|x|+|Y|的最小值 可以发现: |x0+b/d*t| 单调递增 |y0-a/d*t| 单调递减 因为 a>b,所以就是说函数是凹的,先减小后增大。 显然 当y0-a/d*t==0的时候 |x|+|Y| 最小值就在那附近。 枚举几个值就能找到。 #in原创 2014-05-20 21:31:01 · 606 阅读 · 0 评论 -
HRBUST 2024 Strange fuction || HDU 2899 Strange fuction
Sol:求函数的最小值。求两次导数,判断函数的单调性和凹凸性即可,用二分查找即可。 #include #include using namespace std; const double eps = 1e-10; int T; double y; double G(double x) { return 42*pow(x,6)+48*pow(x,5)+21*pow(x,2)+1原创 2014-02-03 22:15:00 · 668 阅读 · 0 评论 -
hrbust 1997 又是一个神奇的布尔矩阵
SoL:模拟就可以了。 #include #include #include using namespace std; const int maxn = 100 + 10; int n,m; int a[maxn][maxn]; int main() { while(~scanf("%d%d",&n,&m)) { for(int i=0;i<=n;i++) a[i][原创 2014-01-15 22:11:04 · 597 阅读 · 0 评论 -
hrbust 1990 函数F(x)
SoL:模拟即可~~ #include #include #include using namespace std; const int maxn = 1000; int solve(int n) { int cnt=0; if(n==1) return 1; for(int i=1;i<=n;i++) { if(n%i==0) cnt++; } return原创 2014-01-15 21:59:29 · 691 阅读 · 0 评论 -
hrbust 1995 伟大的一食堂
SoL:根据题意,即可知道是对3取余和整除的运算找规律的题。 稍微推下就好。 #include #include #include #include using namespace std; int N; int main() { while(~scanf("%d",&N)) { int a,b,s; int cnt=0; while(1) { a=N%原创 2014-01-15 22:07:46 · 526 阅读 · 0 评论 -
hrbust 1993 数硬币
SoL;完全背包。。。 #include #include #include #include using namespace std; const int INF = 0x3f3f3f3f; const int maxm = 10000 + 10; const int maxn = 50 + 10; int dp[maxm]; int value[maxn];//每袋的价格 in原创 2014-01-15 22:04:11 · 632 阅读 · 0 评论 -
hrbust 1992 比赛积分
SoL:01背包。。。 #include #include #include #include using namespace std; const int maxm = 1000 + 10; const int maxn = 100 + 10; int dp[maxm]; int value[maxn];//每袋的价格 int weight[maxn];//每袋的重量 int原创 2014-01-15 22:02:39 · 695 阅读 · 0 评论 -
hrbust 1996 数学等式
SoL:A+B+C==X ---> A+B == X-C ---> AB == X-C。在用二分查找就行。 #include #include using namespace std; const int maxn = 500 + 10; int A[maxn],B[maxn],C[maxn],AB[maxn*maxn]; int h; bool BinarySearch(int原创 2014-01-15 22:09:43 · 480 阅读 · 0 评论 -
hrbust 1994 神奇的布尔矩阵
SoL:模拟即可。。。 #include #include #include #include using namespace std; const int maxn = 200 + 10; int map[maxn][maxn]; int sumcol[maxn],sumrow[maxn]; int n; int main() { while(~scanf("%d",&n))原创 2014-01-15 22:05:51 · 662 阅读 · 0 评论 -
hrbust 1991 计算器显示
SoL:模拟即可。。。- -|| # include # include int main(void) { int n; char s[11]; int i,j,k; while(~scanf("%d %s",&n,s)) { int len = strlen(s); for(i = 0;i < len;++i)原创 2014-01-15 22:00:40 · 644 阅读 · 0 评论 -
HRBUST 1328 相等的最小公倍数
SOl:将原题改为枚举N的每一对因子,计算其是否互素即可。 #include #include #include using namespace std; inline int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } int main() { int n,T,i,j; scanf("%d",&T); while(T原创 2014-05-20 20:54:23 · 697 阅读 · 0 评论