![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PTA
代码好难敲啊~
缓则圆,慢则快。
展开
-
数据结构C++
PTA数据结构 7-2 求素数个数 (30 分)求素数的个数。本题要求编写一个程序,求1~n的素数个数。 要求至少给出两种解法,对于相同的n,给出这两种解法的结果,通过相关数据进行测试,目的是通过对比同一问题不同解法的绝对执行时间体会如何设计“好”的算法。输入格式输入在一行中给出1个整数n(<= 10 000 000)。输出格式对每一组输入,在一行中输出1~n的素数个数。#include<iostream>using namespace std;int原创 2021-09-24 09:09:26 · 191 阅读 · 0 评论 -
删除字符PTA
6-1 删除字符本题要求实现一个删除字符串中的指定字符的简单函数。函数接口定义:void delchar( char *str, char c );其中 char str是传入的字符串,c是待删除的字符。函数delchar的功能是将字符串str中出现的所有c字符删除。裁判测试程序样例:#include <stdio.h>#define MAXN 20void delchar( char *str, char c );void ReadString( char s[] );原创 2020-12-17 23:09:51 · 5597 阅读 · 8 评论