Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
98629 | CSYZ_HeYC | SUM | C++ | 运行超时 | 10 | 1000 MS | 252 KB | 976 | 2023-08-16 12:09:17 |
#include<bits/stdc++.h> using namespace std; #define ll long long template<typename T>inline void read(T &ret){ ret=0;T fh=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-')fh=-1;ch=getchar();} while(isdigit(ch))ret=(ret<<1)+(ret<<3)+(ch^48),ch=getchar(); ret*=fh; } template<typename T>inline void write(T ret,bool flag){ if(ret<0)putchar('-'),ret*=-1; static char out[25];int top=0; do{out[++top]=(ret%10)^48,ret/=10;}while(ret); for(;top;--top)putchar(out[top]); putchar(flag?' ':'\n'); } int t,l,r; inline int gcd(int x,int y){return y?gcd(y,x%y):x;} inline int lcm(int x,int y){return x/gcd(x,y)*y;} inline int solve(){ int ans=0; for(int i=l;i<=r;++i) for(int j=i+1;j<=r;++j) for(int k=j+1;k<=r;++k) ans+=(lcm(i,j)*k/gcd(lcm(i,j),k)>=i+j+k); return ans; } int main(){ // freopen("SUM.in","r",stdin); // freopen("SUM.out","w",stdout); read(t); while(t--){ read(l);read(r); write(solve(),0); } return 0; }