Nastya Studies Informatics】的更多相关文章

B. Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so s…
Nastya Studies Informatics   time limit per test 1 second   memory limit per test 256 megabytes   input standard input output standard output   Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent,…
Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she…
有增长姿势了 如果a * b == lcm * gcd 那么a和b为lcm因数  这个我之前真不知道emm... #include <bits/stdc++.h> #define mem(a, b) memset(a, b, sizeof(a)) using namespace std; typedef long long LL; , INF = 0x7fffffff; LL gcd(LL a, LL b) { ?a:gcd(b, a%b); } int main() { LL l, r, x…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 因为gcd(a,b)=x 所以设a = nx b = mx 又有ab/gcd(a,b)=lcm(a,b)=y 则nmx = y 即n(m*x)=y 所以枚举y的因子n 算出对应的y/n是否为x的倍数 如果是的话,则算出n,m的具体值 然后对于a<b的,答案加两次 如果a==b,答案加一次,a>b不加(避免重复计数) [代码] #include <bits/stdc++.h> #define ll long long usin…
http://codeforces.com/problemset/problem/992/B  题意: 给你区间[l,r]和x,y 问你区间中有多少个数对 (a,b) 使得 gcd(a,b)=x lcm(a,b)=y ,如果a,b交换位置就是不同的数对 思路: 根据lcm(最小公倍数) 的定义 y=a*b/x; 也就是说 x∗y=a∗b : 那么 ,我们发现a,b一定为y的因数,所以我们枚举y的每个因子就可以,我们只要用log(y)的复杂度暴力算每一个因数就可以 , 然后对于每个因子当做a, b…
A. Nastya and an Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nastya owns too many arrays now, so she wants to delete the least important of them. However, she discovered that this…
B. Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so s…
Nastya and an Array 输出有几种不同的数字 #pragma comment(linker, "/STACK:102400000,102400000") #ifndef ONLINE_JUDGE #include "stdafx.h" #else #include<bits/stdc++.h> #endif using namespace std; typedef long long lint; typedef vector<int…
C. Nastya Is Transposing Matrices time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave he…