[JAVA]HDU 4919 Exclusive or】的更多相关文章

题意很简单, 就是给个n, 算下面这个式子的值. $\sum\limits_{i=1}^{n-1} i \otimes (n-i)$ 重点是n的范围:2≤n<10500 比赛的时候 OEIS一下得到了一个公式: $a_0=a_1=a_2=0$; n为偶数 : $2 \times a_{\frac{n}{2}}+2 \times a_{\frac{n}{2}-1}+4\times (\frac{n}{2}-1) $ n为奇数 : $4\times a_{\frac{n-1}{2}}+6\times…
Exclusive or 题目链接: http://acm.hust.edu.cn/vjudge/contest/121336#problem/J Description Given n, find the value of Note: ♁ denotes bitwise exclusive-or. Input The input consists of several tests. For each tests: A single integer n (2≤n<10^500). Output…
Exclusive or Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 327    Accepted Submission(s): 137 Problem Description Given n, find the value of  Note: ⊕ denotes bitwise exclusive-or.   Input T…
题意: 定义 \[f(n)=\sum\limits_{i=1}^{n-1}(i\oplus (n-i))\] 求\(f(n),n \leq 10^{500}\) 分析: 这个数列对应OEIS的A006582 先上公式: \[f(n)=\left\{\begin{matrix} 4f(k)+6k,n=2k+1\\ 2f(k)+2f(k-1)+4k-4,n=2k \end{matrix}\right.\] 递推的思路就是虽然不知道两个数的异或值,但是如果知道这两个数的奇偶性那么结果的奇偶性也就知道了…
== oeis: 点击打开链接 瞎了,x.mod(BigInteger.ValueOf(2)).equal( BigInteger.ValueOf(1)) 写成了 x.mod(BigInteger.ValueOf(2)).equal( 1 ) T^T100块没了.. . import java.math.*; import java.util.*; import static java.lang.System.out; import java.io.*; public class Main {…
A+B for Input-Output Practice (III) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 113961    Accepted Submission(s): 60127 Problem Description Your task is to Calculate a + b.   Input Input con…
A+B for Input-Output Practice (IV) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 105601    Accepted Submission(s): 55782 Problem Description Your task is to Calculate the sum of some integers.…
HDU 4911 Inversion 考点:归并排序 思路:这题呀比赛的时候忘了知道能够用归并排序算出逆序数,可是忘了归并排序的实质了.然后不会做-- 由于看到题上说是相邻的两个数才干交换的时候.感觉归并排序好像不是得要相邻的呀.然后就这样晕--刚才又一次看了才发现,归并就是相邻的交换的,正好是用来求逆序数的,唉--真的是做这个归并排序比赛就来了--真好! #include<iostream> #include<cstdio> #include<cstring> #in…
1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 2014-11-14 0:01:38 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.24 using…
1.错误描述 信息: Initializing Spring FrameworkServlet 'mvc' 11-13 23:43:42 INFO [localhost-startStop-1] org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:455) - FrameworkServlet 'mvc': initialization started 11-13 23:43…