PAT甲级1067 Sort with Swap(0, i) (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:For each case, simply print in a line the minimum number of swaps need to sort the given permutation.Sample Input:103 5 7 2 6 4 9 0 8 1Sample Output:9二、解题思路根据题目,我们要通过不断更换0和其他数字的位置,来进行一个排序。由于
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1068 Find More Coins (30分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input 1:8 95 9 8 7 2 3 4 1Sample Output 1:1 3 5Sample Input 2:4 87 2 4 3Sample Output 2:No Solution二、解题思路01背包问题,是动态规划问题,由于笔者对这方面的知识掌握得还不是很到位,建议大家去翻翻《算法笔记》中关于背包问题的讲述。三、AC代码#incl
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1069 The Black Hole of Numbers (20分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input 1:6767Sample Output 1:7766 - 6677 = 10899810 - 0189 = 96219621 - 1269 = 83528532 - 2358 = 6174Sample Input 2:2222Sample Output 2:2222 - 2222 = 0000二、解题思路给出一个四位数,将这个数字的各位数按
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1070 Mooncake (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:3 200180 150 1007.5 7.2 4.5Sample Output:9.45二、解题思路贪心思想,要得到最大利益,那我们就一直卖单价最高的月饼,卖完之后再买第二高的月饼,以此类推。我们可以用一个结构体表示月饼,里面包含单价、总价和数量,单价可以由总价除以数量得出,将结构体数组按单价从大到小排序,然后按顺序遍历,数量到达题目所给数字时,退
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1066~1070|C++实现

PAT甲级1066 Root of AVL Tree (25分)|C++实现PAT甲级1067 Sort with Swap(0, i) (25分)|C++实现PAT甲级1068 Find More Coins (30分)|C++实现PAT甲级1069 The Black Hole of Numbers (20分)|C++实现PAT甲级1070 Mooncake (25分)|C++实现
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1072 Gas Station (30分)|C++实现

一、题目描述原题链接A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the houses are in its service range.Now given the
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1073 Scientific Notation (20分)|C++实现

一、题目描述原题链接Input Specification:Each input contains one test case. For each case, there is one line containing the real number A in scientific notation. The number is no more than 9999 bytes in length and the exponent’s absolute value is no more than 999
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1074 Reversing Linked List (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:For each case, output the resulting ordered linked list. Each node occupies a line, and is printed in the same format as in the input.Sample Input:00100 6 400000 4 9999900100 1 1230968237 6 -1
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1075 PAT Judge (25分)|C++实现

一、题目描述原题链接The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:​​Output Specification:Sample Input:7 4 2020 25 25 3000002
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1071~1075|C++实现

PAT甲级1071 Speech Patterns (25分)|C++实现PAT甲级1072 Gas Station (30分)|C++实现PAT甲级1073 Scientific Notation (20分)|C++实现PAT甲级1074 Reversing Linked List (25分)|C++实现PAT甲级1075 PAT Judge (25分)|C++实现
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1076 Forwards on Weibo (30分)|C++实现

一、题目描述原题链接Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her foll
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1077 Kuchiguse (20分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input 1:3Itai nyan~Ninjin wa iyadanyan~uhhh nyan~Sample Output 1:nyan~Sample Input 2:3Itai!Ninjinnwaiyada T_TT_TSample Output 2:nai二、解题思路字符串处理题,要求我们找出最长的共用后缀。对于这个题,我们可以每次只对一个
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1078 Hashing (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:4 410 6 4 15Sample Output:0 1 4 -二、解题思路哈希表的基本操作,涉及到了素数检验,解决冲突用平方探测法(只有正数)。用flag标记是否已经找到位置,用occupy数组标记各个位置是否已经被占用。三、AC代码#include<iostream>#include<cstdio>#include
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1079 Total Sales of Supply Chain (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:10 1.80 1.003 2 3 51 91 41 70 72 6 11 80 90 40 3Sample Output:42.4二、解题思路我们可以将输入的每个整体设为一个结构体,包括卖的总货量(如果是retailer),当前的单价以及供应链(如果是supplier)。随后用dfs更新每个retailer或者supplier的价格
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

糟糕,优雅都不见了

再次被提醒,文章不通过
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

加拿大移民申请,想获得移民律师的指导?

加拿大移民申请,想获得移民律师的指导?移民申请杳无音讯,如何查询催促进度?想通过留学、雇主低门槛移民加拿大,却无从入手?如何申请加拿大旅游签?旅游签被拒怎么办?诸如此类的问题,大家可以留言给我哦 或是关注我的某音...
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

不好,没有人中美人计。你们就码一辈子代码吧!!

十篇文章,没有一篇显示通过,这到底是为什么啊?
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

STM32 Keil:warning: #223-D: function "LED_Init" declared implicitly

#include "stm32f10x.h"#include "led.h"int main(){LED_Init();while(1){GPIO_SetBits(GPIOD,GPIO_Pin_6);}}运行时警告:warning:  #223-D: function "LED_Init" declared implicitly解决:在头文件下要声明
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

串口助手收发数据时波特率过高会乱码

在STM32printf重定向实验中,使用printf向串口输出信息时,输出数据会出现乱码现象或者数据缺失现象,如图:理应输出122位数据,当波特率为115200时,输出为2位,并且乱码。解决方法:将波特率调低,以9600为例如图
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

FPGA Verilog分析与综合时出错:Error (10029): Constant driver at state_machine_pkt_top.v(144)

在对Verilog程序分析与综合时,发生错误信息如下:Error (10028): Can't resolve multiple constant drivers for net "data_cnt[15]" at state_machine_pkt_top.v(160)Error (10029): Constant driver at state_machine_pkt_top.v(144...
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0