QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#510269#9158. 分数hypeskynick#Compile Error//C++14596b2024-08-09 01:04:332024-08-09 01:04:33

Judging History

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

  • [2024-08-09 01:04:33]
  • 评测
  • [2024-08-09 01:04:33]
  • 提交

answer

// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;
bool valid(int x, int y){
	if(x/y==0)return valid(y,x);
	if(y<1||x<2*y)return false;
	if(y==1)return (x%2==0);
	return valid(x%(2*y),y);
}

int main() {
	//find all perfect fractions less than 1/2 and place them into
	// an array then propogate numerator and denominator to their limits
	int n,m,ans=0;
	cin >> n >> m;
	vector<pair<int,int>> perf;
	for (int i =1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(gcd(i,j)!=1)continue;
			if(valid(i,j))ans++;
		}
	}
	cout << ans << "\n";
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:20:28: error: ‘gcd’ was not declared in this scope
   20 |                         if(gcd(i,j)!=1)continue;
      |                            ^~~