zoukankan      html  css  js  c++  java
  • HDOJ 3723 Delta Wave

    网上抄的,Java的大数运算。
    第一次提交JAVA的程序

    Delta Wave

    Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 474    Accepted Submission(s): 152


    Problem Description
    A delta wave is a high amplitude brain wave in humans with a frequency of 1 – 4 hertz which can be recorded with an electroencephalogram (EEG) and is usually associated with slow-wave sleep (SWS).
    -- from Wikipedia

    The researchers have discovered a new kind of species called "otaku", whose brain waves are rather strange. The delta wave of an otaku's brain can be approximated by a polygonal line in the 2D coordinate system. The line is a route from point (0, 0) to (N, 0), and it is allowed to move only to the right (up, down or straight) at every step. And during the whole moving, it is not allowed to dip below the y = 0 axis.

    For example, there are the 9 kinds of delta waves for N = 4:


    HDOJ  3723  Delta Wave - qhn999 - 码代码的猿猿



    Given N, you are requested to find out how many kinds of different delta waves of otaku.
     

    Input
    There are no more than 20 test cases. There is only one line for each case, containing an integer N (2 < N <= 10000)

     

    Output
    Output one line for each test case. For the answer may be quite huge, you need only output the answer module 10100.
     

    Sample Input
    34
     

    Sample Output
    49
     

    Source
     

    Recommend
    zhouzeyong
     


    View Code

    Problem : 3723 ( Delta Wave )     Judge Status : Accepted
    RunId : 8303330    Language : Java    Author : CKboss
    Code Render Status : Rendered By HDOJ Java Code Render Version 0.01 Beta

    import java.math.BigInteger;
    import java.util.Scanner;

    public class Main
    {
        public static void main(String[] args)
        {
            Scanner sc=new Scanner(System.in);
            BigInteger mod=BigInteger.TEN.pow(100);
            BigInteger sum=new BigInteger("0");
            BigInteger t=new BigInteger("0");
            while(sc.hasNext())
            {
                int n=sc.nextInt();
                sum=BigInteger.ONE;
                t=BigInteger.ONE;
                for(int k=1;k+k<=n;k++)
                {
                    t=t.multiply(BigInteger.valueOf((n-2*k+1)*(n-2*k+2)))
                            .divide(BigInteger.valueOf(k*(k+1)));
                    sum=sum.add(t);
                }
                System.out.println(sum.mod(mod));
            }
        }
    }

  • 相关阅读:
    Android签名详解(debug和release)
    Java反射机制的学习
    Android应用开发中如何使用隐藏API(转)
    asp.net购物车,订单以及模拟支付宝支付(二)---订单表
    asp.net购物车,订单以及模拟支付宝支付(一)---购物车表及添加购物车流程
    asp.net权限控制的方式
    .Net使用程序发送邮件时的问题
    Word2016“此功能看似已中断 并需要修复”问题解决办法
    C#字符串来袭——因为爱,所以爱
    C#时间的味道——任时光匆匆我只在乎你
  • 原文地址:https://www.cnblogs.com/CKboss/p/3351062.html
Copyright © 2011-2022 走看看