HDU 3903 Trigonometric Function】的更多相关文章

Trigonometric Function Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others) Total Submission(s): 693 Accepted Submission(s): 277 Problem Description Give you a triangle ABC. Get more information in the picture below. Now,…
这题真难,并不会推理... #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; long long a, b, c; int p; int main() { int T; scanf("%d", &T); while (T--) { scanf("%lld%lld%lld", &a…
普通的数位DP计算回文串个数 /* HDU 6156 - Palindrome Function [ 数位DP ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 2-36进制下回文串个数 */ #include <bits/stdc++.h> using namespace std; #define LL long long int t, L, R, l, r, base; int dig[40], tmp[40]; LL dp[40][40][40][2]; LL DFS(int p…
/* HDU 6050 - Funny Function [ 公式推导,矩阵快速幂 ] 题意: F(1,1) = F(1, 2) = 1 F(1,i) = F(1, i-1) + 2 * F(1, i-2) , i >= 3 F(i, j) = ∑ F(i-1, j) , k∈[j, j+N-1] 给定 N, M < 2^63, 求 F(M,1) 分析: ∵ F(2,1) = F(1,1) + F(1,2) + ... + F(1,N) F(2,2) = F(2,1) + F(1,N+1) -…
Simple Function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 111    Accepted Submission(s): 31 Problem Description Knowing that x can be any real number that x2 + Dx + E ≠ 0. Now, given the f…
http://acm.hdu.edu.cn/showproblem.php?pid=6156 题意:$f(n,k)$表示判断n在k进制下是否是回文串,如果是,则返回k,如果不是,则返回1.现在要计算$\sum_{i=L}^{R}\sum_{j=l}^{r}f(i,j)$. 思路:因为我不会数位dp,所以我直接模拟做了一发,写得十分繁琐... 先是将数转换成k进制,然后去计算出它的前一半的数,只要小于该数那都是成立的 ,比如说现在前面的数为985,那么1~984的数都是满足的,绝对不会超. 思路大…
题目链接 Problem Description Function Fx,ysatisfies: For given integers N and M,calculate Fm,1 modulo 1e9+7. Input There is one integer T in the first line. The next T lines,each line includes two integers N and M . 1<=T<=10000,1<=N,M<2^63. Output…
http://acm.hdu.edu.cn/showproblem.php?pid=5875 单调栈,预处理to[i]表示第一个比a[i]小的数字,一直跳就可以. 这题是数据水而已. 这里学习下单调栈. 构造一个单调递增的栈,并且记录元素大小的同时记录它的id. 每次进来一个小的元素的话,就出栈,同时出栈的这个元素的to[id] = i了,因为这个元素是当时最大的.然后这个a[i]是第一个能让它出栈的,所以就是它了.后面的同理. #include <cstdio> #include <c…
http://acm.hdu.edu.cn/showproblem.php?pid=6156 [AC] #include<bits/stdc++.h> using namespace std; typedef long long ll; ; ]; int L,R,l,r; ll query(int x,int k) { ) ; ; int cp=x; while(cp) { num[cnt++]=cp%k; cp/=k; } ,tot=; ;i<cnt;i++) { tot+=base-…
Funny Function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1109    Accepted Submission(s): 527 Sample Input 2 2 2 3 3 Sample Output 2 33 Source 2017 Multi-University Training Contest - Team…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6588 题目大意:求\(\sum_{i=1}^{n}gcd(\left \lfloor \sqrt[3]{i} \right \rfloor,i),\ n\leq 10^{21}\) 题解:考虑对\(\left \lfloor \sqrt[3]{i} \right \rfloor\)分块,将式子转换成\(\sum_{i=1}^{\left \lfloor \sqrt[3]{n} \right \rfl…
Funny Function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1213    Accepted Submission(s): 594 Problem Description Function Fx,ysatisfies:For given integers N and M,calculate Fm,1 modulo 1e9…
题目链接 快速求出a到b之间所有数的欧拉函数. 一个一个求肯定是不行的, 我们知道欧拉函数的公式为phi(n) = n*(1-1/i1)*(1-1/i2).......i1, i2为素因子. 那么我们就可以先将每一个数的欧拉函数值预处理出来. 具体看代码 #include<bits/stdc++.h> using namespace std; #define pb(x) push_back(x) #define ll long long #define mk(x, y) make_pair(x…
思路: 数位dp的操作是dfs+记忆化,我们dp开四维:位置,长度,进制,是否回文.然后每次暴搜记录下每个位置的数字是什么,搜到对称轴另一边需要检查是否符合回文. 终于把友谊赛的题目都补完了...没做出来的都是学过的,做出来的都是没学过骚操作过的...学以不致用... 代码: #include<cstdio> #include<set> #include<stack> #include<cstring> #include<algorithm> #…
虽然三角函数是初中知识,比较简单,却也因为是初中知识,距现在比较久,难免忘掉一些,所以复习一下. 三角函数英文单词 正弦:sine 余弦:cosine 正切:tangent 余切:contangent 正割:secant 余割:cosecant 三角函数的定义 正弦:\(\sin \alpha = \frac{y}{r}\) 余弦:\(\cos \alpha = \frac{x}{r}\) 正切:\(\tan \alpha = \frac{y}{x}\) 余切:\(\cot \alpha = \…
[Link]:http://codeforces.com/contest/834/problem/C [Description] 给你两个排列a和b; a排列的长度为n,b排列的长度为m; a∈[0..n-1],b∈[0..m-1]; 然后让你求一个函数f[i]; f[i]的定义域为0..n-1,值域为0..m-1 同时使得对于任意f[i],i∈[0..n-1]; f(i)=bf(a[i])成立; [Solution] 原始可以递推一下; f(i)=bf(ai)=bbf(aai) 则可以一直写下…
题目链接 暴力打个表找下规律就好了,比赛时看出规律来了倒是,然而看这道题看得太晚了,而且高中的那些数列相关的技巧生疏了好多,然后推公式就比较慢..其实还是自身菜啊.. 公式是 #include<bits/stdc++.h> using namespace std; typedef long long LL; ; LL qpow(LL x,LL n) //求x^n%mod { LL ret=; ) { ) ret=ret*x%mod; x=x*x%mod; } return ret; } LL…
就算告诉我是矩阵快速幂我也推不出递推式呀!!! 官方题解: 对于任意i>=1,当j>=3时,有通过归纳法可以得到 进而推导出 后来自己重新推导了一遍 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; const…
2ed,  by Timothy Sauer DEFINITION 1.3A solution is correct within p decimal places if the error is less than 0.5 × 10$^{−p}$ .-P29Bisection Method的优点是计算次数(step)是确定的(interval<精度).后面介绍的算法的interval是不确定的, 所以什么时候结束计算呢?不知道.所以定义“stopping criteria’’来决定什么时候结束…
MTRX1702 - C ProgrammingAssignment 1This assignment requires you to design and build a program to compute and display tables oftrigonometric values.This assignment should take an average student 15 hours to complete.Submission deadline: 11:59pm on Su…
2ed,  by Timothy Sauer DEFINITION 1.3A solution is correct within p decimal places if the error is less than 0.5 × 10$^{−p}$ .-P29Bisection Method的优点是计算次数(step)是确定的(interval<精度).后面介绍的算法的interval是不确定的, 所以什么时候结束计算呢?不知道.所以定义“stopping criteria’’来决定什么时候结束…
SIMILINK模块库按功能进行分为以下8类子库:Continuous(连续模块)Discrete(离散模块)Function&Tables(函数和平台模块)Math(数学模块)Nonlinear(非线性模块)Signals&Systems(信号和系统模块)Sinks(接收器模块)Sources(输入源模块) 连续模块(Continuous)continuous.mdlIntegrator:输入信号积分Derivative:输入信号微分State-Space:线性状态空间系统模型Trans…
AC: F I. rank 40/88. 开场看了F发现是个简单的DP,随便写了一下WA,,,发现把样例倒着输就过不了了...原来是忘了最后的时候开始上课的话可能上不了多久... 想到一个简洁的状态方程,然后以为是单调队列优化,突然发现好像只需要求个最小值就行了...改改AC了.. 看榜发现I过了很多,看了一下就是个同色三角形裸题..A了然后就没有然后了... 看了一下B.第一感觉KMP,感觉通配符的情况不大好处理...没学AC自动机... C.求多边形的对称轴...但是枚举对称轴好像会TLE?…
Generating Gaussian Random Numbers http://www.taygeta.com/random/gaussian.html This note is about the topic of generating Gaussia  pseudo-random numbers given a source of uniform  pseudo-random numbers. This topic comes up more frequently than I woul…
Introduction Calculating the distance between geographical coordinates is based on some level of abstraction; it does not provide an exact distance, which is unattainable if one attempted to account for every irregularity in the surface of the earth.…
Well, to begin with, I'd like to say thank you to MIT open courses twice. It's their generosity that gives me the priviledge to enjoy the most outstanding education resources. Okay, come to the point -- The Frequency in Oscillation System. In general…
周末,跟着m3w师傅打ISITDTUCTF,m3w师傅带弟弟上分,Tql! Web1 给了源码: <?php class Read{ public $flag; public function __wakeup(){ echo file_get_contents($this->flag); } } if(isset($_GET['username'])){ if(isset($_GET['password'])) { $password = $_GET['password']; unseria…
现在我们在工作中,在开发中都会或多或少的用到图表统计数据显示给用户.通过图表可以很直观的,直接的将数据呈现出来.这里我就介绍说一下利用百度开源的echarts图表技术实现的具体功能. 1.对于不太理解echarts是个怎样技术的开发者来说,可以到echarts官网进行学习了解,官网有详细的API文档和实例供大家参考学习. 2.以下是我在工作中实现整理出来的实例源码: 公用的支持js文件 echarts.js.echarts.min.js,还有其他的图表需要支持的js文件也可以到官网下载 echa…
GTW likes function 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5596 Description Now you are given two definitions as follows. f(x)=∑xk=0(−1)k22x−2kCk2x−k+1,f0(x)=f(x),fn(x)=f(fn−1(x))(n≥1) Note that φ(n) means Euler's totient function.(φ(n)is an…
Function Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 976    Accepted Submission(s): 375 Problem Description The shorter, the simpler. With this problem, you should be convinced of this tru…