QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#155550#5503. Euclidean Algorithm275307894aTL 0ms4020kbC++14918b2023-09-01 19:47:452023-09-01 19:47:46

Judging History

你现在查看的是最新测评结果

  • [2023-09-01 19:47:46]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:4020kb
  • [2023-09-01 19:47:45]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__int128;
const int N=2e6+5,M=N*4+5,K=600+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const ll INF=1e18+7;mt19937 rnd(time(0));
int n;
void Solve(){
	int i,j;scanf("%d",&n);
	int ans=0;for(i=1;i<=n;i++){
		for(j=i+1;j<=n;j++){
			ans+=((j-__gcd(i,j))%i==0);
			// if((j-gcd(i,j))%i) cerr<<i<<' '<<j<<'\n';
		} 
	}
	printf("%d\n",ans);
}
int main(){
	int t;
	scanf("%d",&t);
	// t=1;
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 4020kb

input:

3
2
5
14

output:

1
9
62

result:

ok 3 lines

Test #2:

score: -100
Time Limit Exceeded

input:

3
29107867360
65171672278
41641960535

output:


result: