HDU 1995 汉诺塔V
    
            
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1995列表画一下,规律即出View Code #include <stdio.h>#include <string.h>#include <stdlib.h>__int64 pow(int a,int b){ int i; __int64 s=1; for(i=0;i<b;i++) s*=a; return s;}__int64 dp[70][70];int main(){ int t,n,m,i,j; for(i=1;i<61;i++) for...
        
阅读全文
 
            
         
        
            
    HDU 1282 回文数猜想
    
            
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1282两种想法,用字符串处理或是用数字处理,这里数字处理更简单View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int IsHw(int n){ int p,ans=0; p=n; while(n) { ans=ans*10+n%10; n/=10; } if(ans==p)return 1; return 0;}int Nx...
        
阅读全文
 
            
         
        
            
    BJTU 1621 A Simple Math Problem
    
            
摘要:http://acm.bjtu.edu.cn/problem/detail?pid=1621(1)总矩形数:考虑1行n个,由一个、两个、三个......1*1正方形组成的方法数为n、n-1、n-2......1,和为(n+1)*n/2(2)正方形数:n*m的矩形,不妨设n<m,则最大的矩形为n*n,这样的矩形根据乘法原理有1*(m-n+1)个,依次考虑(n-1)*(n-1)......1*1的矩形,方法数同理可得另附HDU 2524 矩形A+B,与此题一个思路,不过只考虑(1)罢了http://acm.hdu.edu.cn/showproblem.php?pid=2524View Cod
        
阅读全文
 
            
         
        
            
    HDU 2086 A1=?
    
            
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2086找规律,自己推公式。View Code #include <stdio.h>int main(){ int n,i; double a0,a1,n1,a[5000]; while(~scanf("%d",&n)) { scanf("%lf%lf",&a0,&n1); for(i=0;i<n;i++) scanf("%lf",&a[i]); a1=n*a0+n1; for(i=1;i<=n;
        
阅读全文