数学 SCU 4436 Easy Math】的更多相关文章

题目传送门 /* 数学题:当有一个数开根号后是无理数,则No */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <iostream> #include <string> #include <map> #include <set> using…
4436: Easy Math Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.scu.edu.cn/soj/problem.action?id=4436 Description Given n integers a1,a2,…,an, check if the sum of their square root a1+a2+…+an is a integer. Input The input consists of multiple…
题目链接:http://acm.scu.edu.cn/soj/problem/4436/ 题意:给你n个整数,求这n个数的平方根和是否是一个整数: 解题思路:如果这题每个数给他算出来,必然费时间,可能还会超精度,所以巧妙的方法就是判断这些整数是否全是完全平方数,如果有一个不是,则他们的平方根和肯定不是一个整数. AC代码: #include <cstdio> #include <cmath> #include <cstring> #include <algorit…
A. Easy Math Time Limit: 2000ms Memory Limit: 65536KB Given n integers a1,a2,-,an, check if the sum of their square root a1−−√+a2−−√+⋯+an−−√ is a integer. Input The input consists of multiple tests. For each test: The first line contains 1 integer n…
题目链接:Easy Math 题目大意:给定\(n(1\leqslant n\leqslant 10^{12}),m(1\leqslant m\leqslant 2*10^{9})\),求\(\sum_{i=1}^{m}\mu (i\cdot n)\). 题解:废话少说,直接上公式 $$\mu(i\cdot n)=\left\{\begin{matrix}\mu(i)\cdot\mu(n) & gcd(i,n)==1\\ 0 & other\end{matrix}\right.$$ 设 $…
比赛快结束的适合看了一下D题,发现跟前几天刚刚做过的HDU 5728 PowMod几乎一模一样,当时特兴奋,结果一直到比赛结束都一直WA.回来仔细一琢磨才发现,PowMod这道题保证了n不含平方因子,而Easy Math却没有.只要加一条特判,这道题就过了. AC代码贴在下面.求莫比乌斯函数前缀和的那一部分是我当时在网上临时找的代码,向那位仁兄道谢. #include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int…
Math 提供了大量的数学操作方法 Math类中所有的方法都是static 方法…
代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 20000000; bool check[N+20]; int prime[N+20], mu[N+20], tot; void mobius() { memset(check, 0, sizeof(check)); mu[1] = 1; tot = 0; for(int i = 2; i <= N; ++i) { if…
目录 @description@ @solution@ @accepted code@ @details@ @description@ 求: \[\sum_{i=1}^{n}\sum_{j=1}^{n}gcd^k(i, j)\times lcm(i, j)\times [gcd(i, j) \in prime] \mod 10^9 + 7 \] 原题传送门. @solution@ \[\begin{aligned} ans &= \sum_{i=1}^{n}\sum_{j=1}^{n}gcd^k…