题解 1157: 亲和数

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

简洁明了的亲和数

摘要:解题思路:1、编写一个函数将数字拆开并返回一个值                2,对比两个数及其返回值注意事项:参考代码:#include<stdio.h>int fun(int n){    in……

【亲和数】 (C语言代码)

摘要:参考代码:#include<stdio.h> int main() {  int a, b, i, n,e, sum1=0,sum2=0;  //sum1是保存数b的因数和,sum2是保存数a的……

【亲和数】 (C语言代码)

摘要:解题思路:  注意事项:参考代码:#include<stdio.h>int main(){    int n;    scanf("%d",&n);    while (n--)    {      ……

【亲和数】 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include <stdio.h>#include <stdlib.h>int main() {     int M;     int *a, *b;        i……

【亲和数】 (C语言代码)

摘要:解题思路:注意事项:注意sum1和sum2每次循环归零 参考代码:#include<stdio.h>int main(){ int n=0,a=0,b=0,sum1=0,sum2=0,i=0,k=0;……

【亲和数】 (C语言代码)

摘要:解题思路:1判断a, b的输入条件2分别判断a,b互相的真约数是否与对方相等3如果有一个相等即可输出YES,a,b不符合条件或者不存在相等则输出NO注意事项:参考代码:#include<stdio.h……

【亲和数】 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include<stdio.h> int main() {  int a,b,c,d,i=1,s1,s2;  scanf("%d\n",&a);  while(i<=a……

【亲和数】 (C++代码)

摘要:解题思路:定义一个判断亲和数的函数注意事项:参考代码:#include<iostream>using namespace std;bool qinhe(int a, int b){ int s1 = ……

【亲和数】 (Java代码)

摘要:解题思路:    1.用变量保存输入的两个数字     2.取出其中一个数字,从1开始到这个数字循环取模,如果能够整除就累加    3.如果累加的结果正好等于另一个数字,就可以输出 YES    4.……