首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
阿灿
2025年3月25日 10:51
最简真分数 题解:
P1180
回复 0
|
赞 2
|
浏览 363
#include<bits/stdc++.h> using namespace std; int gcd(int a,int b){ return b==0?a:gcd(b,a%b); } int main(){ int n; int buf[600]; while(cin>>n){ for(int i=0;i<n;i++){ cin>>buf[i]; } int ans=0; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){...
Elysiaaaaaaa
2025年3月9日 09:29
最简真分数 题解:
P1180
回复 1
|
赞 14
|
浏览 479
#include<bits/stdc++.h> //#include<algorithm> 中有__gcd(int a,int b); 但是不一定都支持 using namespace std; //递归的写法 int gcd(int a,int b){ if(b==0) return a; else return gcd(b...
Chen沧月有泪
2025年2月19日 11:51
最简真分数 题解:
P1180
回复 0
|
赞 5
|
浏览 616
#include<iostream> #include<algorithm> //判断两个数的最大公因数 int maxNum(int i, int j) { //i<j while (1) { int temp = j % i; j = i; &nb...
西电机试专家
2025年2月11日 15:10
最简真分数 题解:约鬼吹灯算法
P1180
回复 0
|
赞 3
|
浏览 507
#include <bits/stdc++.h> using namespace std; //最简真分数 //定义:在真分数的基础上,分子与分母互质(最大公约数为1),即不可再约分的真分数。 int main(){ int n; while(cin>>n){ int a[601]; for(int i=0;i&...
18919717626
2024年7月6日 21:21
最简真分数 题解:最小公倍数+最大公约数
P1180
回复 0
|
赞 2
|
浏览 896
#include <iostream> #include <algorithm> using namespace std; const int N = 1000; int gcdx(int a,int b){ return b ? gcdx(b,a % b):a; } int main(){ int n; while(cin >> n){ if(n == 0)break; int a[N],count = 0; for(int i = 0;i < n;i ++)cin >>...
Candour
2024年5月5日 00:27
最简真分数(最大公约数) 题解:
P1180
回复 0
|
赞 5
|
浏览 1.0k
最大公约数是1,说明两个数互质,也就是最简真分数 #include<bits/stdc++.h> using namespace std; const int N = 1010; int n; int a[N]; int main() { while(cin >> n, n) { int res = 0; for(int i = 0; i < n; i ++) scanf("%d", &a[i]); ...
williams
2024年3月25日 09:00
最简真分数 题解:算法上感觉对了,但是AC不了
P1180
回复 6
|
赞 6
|
浏览 1.7k
#include <stdio.h> #include <stdbool.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h> int judge(int a,int b){ for(int i=2;i<a;i++){ if(a%i==0&&b%i==0) return 1; //不是最简真...
Śś
2024年3月22日 14:16
最简真分数 题解:
P1180
回复 0
|
赞 0
|
浏览 761
#include<iostream> #include<algorithm> using namespace std; int A[600+1]; int gcd(int a,int b) { if(a==0)return b; return gcd(b%a,a); } int main() { int n; while(cin>>n) &...
wei886521
2024年3月20日 17:00
最简真分数 题解:
P1180
回复 0
|
赞 0
|
浏览 843
#include <iostream> using namespace std; #define max 100 void maopao(int *a, int len){//升序排列 int tempt; for (int i = 0; i < len; i++){ for (int j = 0; j < len - 1 - i; j++) &nbs...
光明守护神
2024年3月18日 10:35
所以1 2 2,有两个组合,1/2和1/2
P1180
回复 0
|
赞 1
|
浏览 1.0k
#include<algorithm> #include<iostream> #include<vector> using namespace std; void unique(vector<int>& v) { for (auto i = v.begin(); i < v.end() - 1; ) { if (*i == *(i + 1)) { i = v.erase(i); } else { i++; } } for (auto t : ...
1
2
3
题目
最简真分数
题解数量
25
发布题解
在线答疑
热门题解
1
最简真分数 题解:
2
最简真分数 题解:算法上感觉对了,但是AC不了
3
最简真分数(最大公约数) 题解:
4
最简真分数 题解:
5
最简真分数 题解:C
6
最简真分数 题解:约鬼吹灯算法
7
最简真分数 题解:使用 __gcd()函数
8
最简真分数 题解:
9
最简真分数 题解:最小公倍数+最大公约数
10
最简真分数 题解:有个疑问