loops循环语句 一 if语句,if语句配合else使用,可以没有else. 单分支if语句 age = input('Age:') password = '67' if age == password: print('==') 多分支语句 age = int(input('Age:')) password = 67 if age == password: print('==') if age > password: print('>') if age < password: prin
这是个NOIP原题... 题意: 给定 a b c d 求 gcd(a, x) = b && lcm(c, x) = d 的x的个数. 可以发现一个朴素算法是从b到d枚举,期望得分50分. (为什么lyd大佬的暴力就是90...) 有个要点就是所求的x必定为d的约数. 然后根据lcm和gcd的性质,拆成质因数. x的每个质因数个数是有范围的,可以求出来. 然后乘起来就行了. 注意要分类讨论,别用书上写的,有毒. #include <cstdio> ; int p[N], top
感慨 最终就做出来一个题,第二题差一点公式想错了,又是一波掉分,不过我相信我一定能爬上去的 A Find Divisible(思维) 上来就T了,后来直接想到了题解的O(1)解法,直接输出左边界和左边界*2即可 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long x,y,t; cin>>t;
GCD Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Submission(s): Problem Description The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),,)=,(,)=. (a,b) can be e