也可以看看GCD Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 11122 Accepted Submission(s): 4696 Problem Description 有三个正整数a,b,c(0<a,b,c<10^6),当中c不等于b.若a和c的最大公约数为b,现已知a和b,求满足条件的最小的c. Input 第一行…
树状数组... Different GCD Subarray Query Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1541 Accepted Submission(s): 599 Problem Description This is a simple problem. The teacher gives Bob a lis…
这个题真的很水,但我竟然连错,在此警醒自己!!! 写代码改了东边,忘了西边,“认真”这两个字又被我吃了,打脸啪啪啪啪. #include<iostream> using namespace std; int gcd(int a, int b) { int t; while(b) { t = a; a = b; b = t%b; } return a; } int main() { int T; cin>>T; while(T--) { long long a, b; cin>…