QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#155549#5503. Euclidean Algorithm275307894aCompile Error//C++14916b2023-09-01 19:47:242023-09-01 19:47:25

Judging History

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

  • [2023-09-01 19:47:25]
  • 评测
  • [2023-09-01 19:47:24]
  • 提交

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';
}

详细

answer.code: In function ‘void Solve()’:
answer.code:19:34: error: ‘gcd’ was not declared in this scope
   19 |                         ans+=((j-gcd(i,j))%i==0);
      |                                  ^~~
answer.code:16:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         int i,j;scanf("%d",&n);
      |                 ~~~~~^~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:27:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |         scanf("%d",&t);
      |         ~~~~~^~~~~~~~~