c
文章平均质量分 58
Grifth
2020级本科生一枚
展开
-
A. Playoff
A Playoff原题地址Consider a playoff tournament where 2n2^n2n athletes compete. The athletes are numbered from 111 to 2n2^n2n.The tournament is held in nnn stages. In each stage, the athletes are split into pairs in such a way that each athlete belongs exact原创 2022-03-12 00:41:30 · 1435 阅读 · 0 评论 -
m趟选择排序
先在第一行输入整数n和m,再在第二行输入n个整数构成的数列,要求利用选择排序(每趟排序最多交换一次)进行排序,并输出第m趟排序后的数列状况。请把选择排序定义为一个函数。输入格式:测试数据有多组,处理到文件尾。对于每组测试,先在第一行输入整数n和m(1<m<n<=40),再在第二行输入n个整数。输出格式:对于每组测试,输出m趟选择排序后的结果,每两个数据之间留一个空格。输入样例:6 33 5 1 2 8 64 39 8 7 6输出样例1 2 3 5 8 66 7原创 2021-12-26 12:17:29 · 1464 阅读 · 2 评论 -
不一样的人生密码
每个人都有一个人生密码,只有两个人的人生密码相同,才能走到一起,给出n个人的人生密码,n是奇数,其中只有一个人的人生密码是单独的,其它都是成对的,请你找出不成对的那一个。输入格式:多实例测试,每行第一个数为n(1<=n<=1000000),后面有n个正整数,表示n个人的人生密码 。 n值为0表示输入结束。输出格式输出那个不成对的人生密码。输入样例3 8 9 85 120 10 120 10 850输出样例985时间限制400ms#include<stdio原创 2021-12-11 14:09:24 · 1282 阅读 · 3 评论 -
数据结构大作业(关于二叉树)
二叉树及其相关操作要求代码实现#include<iostream>using namespace std;#include <stdio.h>#include <stdlib.h>#define MAXSIZE 100struct TNode{ char data; TNode* left; TNode* right;};typedef TNode* BinTree;TNode* root = NULL; vo原创 2021-11-30 10:36:00 · 335 阅读 · 0 评论 -
c语言数组讲解
数组数组是用来存储一系列数据,但它往往被认为是一系列相同类型的变量。数组的声明并不是声明一个个单独的变量,比如 runoob0、runoob1、…、runoob99,而是声明一个数组变量,比如 runoob,然后使用 runoob[0]、runoob[1]、…、runoob[99] 来代表一个个单独的变量。所有的数组都是由连续的内存位置组成。最低的地址对应第一个元素,最高的地址对应最后一个元素。数组的第一个为0(重点)数组的申明在 C 中要声明一个数组,需要指定元素的类型和元素的数量,如下所原创 2021-11-29 23:40:41 · 227 阅读 · 0 评论 -
c语言基础题集合
c语言基础题原创 2021-11-20 21:26:35 · 10464 阅读 · 0 评论 -
leetcode周赛
leetcode周赛中的学习第一题学习到了大神的for增强的用法题目给你一个字符串s 和一个字符串数组 words ,请你判断s是否为words 的 前缀字符串 。字符串 s 要成为 words 的 前缀字符串 ,需要满足:s可以由words 中的前 k(k为 正数 )个字符串按顺序相连得到,且k 不超过 words.length 。如果s是 words 的 前缀字符串 ,返回 true ;否则,返回 false 。我的代码class Solution {public: b原创 2021-08-08 20:24:02 · 173 阅读 · 0 评论 -
树的建立(二叉树)
树You are to determine the value of the leaf node in a given binary tree that is the terminal node of apath of least value from the root of the binary tree to any leaf. The value of a path is the sum of valuesof nodes along that path.inputThe input fil原创 2021-07-29 20:46:19 · 251 阅读 · 0 评论 -
广度优先搜索(BFS)
广度优先搜索(BFS)写在晚上2点终于搞明白了!!!例题Knight MovesBackgroundMr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?The ProblemYour task is to write a program to cal原创 2021-07-24 01:44:32 · 131 阅读 · 1 评论