![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PTA题目
敲不会代码也学不会英语
Google
展开
-
7-5 水仙花数 (20 分)
重点是把循环搞好 #include <stdio.h> #include <string.h> #include <math.h> int f(int n,int z) { int s=0,i,a; int flag; int m=n,b; while(n) { a=n%10;b=1; fo...原创 2019-12-28 14:41:58 · 1755 阅读 · 0 评论 -
7-5 素数对猜想
这道题用函数的方法更简便。 解题思路:找到素数,在这里定义一个函数去判断在n之内并且包含n的数是不是素数,通过对是否素数的判断,进行下一步的计算,这样的方法是很巧妙的。 由题意可知素数对无法在2和3之间产生,且素数对是在相邻两者之间产生的,通过交换值进行计算。 以下代码如下。 #include<stdio.h> #include <math.h> int f(int m) ...原创 2019-12-22 21:40:04 · 163 阅读 · 0 评论