自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 环形序列——字符串处理

题目:长度为n的环形串有n种表示法,分别为从某个位置开始顺时针得到。在这些表示法中,字典序最小的称为“最小表示”。输入一个长度为n的环形串,你的任务是输出该环形串的最小表示。例如,CTCC的最小表示是CCCT,CGAGTCAGCT的最小表示为AGCTCGAGTC。我的想法和代码(没有实现)#include<stdio.h>#include<string.h>#define maxn 50int main(){ char s[maxn],head[maxn]

2020-07-31 23:04:56 977

原创 生成元——数组

题目:如果x加上x的各个数字之和得到y,就说x是y的生成元。给出n,求最小生成元,无解则输出0.n=216,121,2005时的解分别为198,0,1979代码#include<stdio.h>#include<string.h> #define maxn 100005int main(){ int a[maxn]; int x=0,y=0; int p; memset(a,0,sizeof(a)); //要带上string.h头文件 for(int

2020-07-31 22:07:03 536

原创 猜数字游戏的提示——数组

题目:实现一个经典“猜数字”游戏。给定答案序列和用户猜的序列,统计有多少数字位置正确(A),有多少数字在两个序列都出现过但位置不对(B)。输入包含多组数据。每组输入第一行为序列长度n,第二行是答案序列,接下来是若干猜测序列。猜测序列全0时该组数据结束。n=0时输入结束。样例输入41 3 5 51 1 2 34 3 3 56 5 5 16 1 3 51 3 5 50 0 0 0101 2 2 2 4 5 6 6 6 91 2 3 4 5 6 7 8 9 11 1 2 2 3

2020-07-31 21:42:17 172

原创 PAT (Advanced Level)1005 Spell It Right (20分)

Given a non-negative integerN, your task is to compute the sum of all the digits ofN, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Each case occupies one line which contains anN(≤10​100​​)...

2020-07-31 00:36:06 92

原创 整数拆分——leetcode

题目描述https://leetcode-cn.com/problems/integer-break/给定一个正整数n,将其拆分为至少两个正整数的和,并使这些整数的乘积最大化。 返回你可以获得的最大乘积。感觉用数学法比较简单(动态规划目前还不会:(哭唧唧class Solution {public: int integerBreak(int n) { int x,y; if(n<4){ cout<<n-1;.

2020-07-31 00:08:46 91

原创 判断回文串镜像串

回文串是反转后与原串相同,镜像串是左右镜像后和原串相同。#include<stdio.h>#include<string.h>#define maxn 50const char nor[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";const char rev[]="A 3 HIL JM O 2TUVWXY51SE Z 8 ";const char* msg[]={"is not a palindrome.","is a

2020-07-30 22:16:41 226

原创 WERTYU——字符数组移位

题目:输入一个错位敲出的字符串,输入打字员本来想打出的句子。输入保证合法,即一定是错位之后的字符串。样例输入o s, gomr ypfsu/样例输出i am fine today.代码#include<stdio.h>#include<string.h>int main(){ char s[]="`1234567890-=qwertyuiop[]asdfghjkl;'\\zxcvbnm,./`"; char c; char *position

2020-07-30 21:33:19 269

原创 TeX中的引号——获取输入字符/字符串

题目:在TeX中,左双引号是“··”,右双引号是“''”,输入一篇包含双引号的文章,你的任务是把它转换成TeX的格式。样例输入:"To be or not to be," quoth the Bard, "that is the question".样例输出:``To be or not to be,'' quoth the Bard,``that is the question''.代码#include<stdio.h>#define LOCALint ma

2020-07-30 20:50:34 297

原创 竖式问题——字符数组

题目:找出所有形如abc*de(三位数乘以两位数)的算式,使得在完整的竖式中,所有数字都属于一个特定的数字集合。输入:数字集合2357输出:所有竖式及解的个数<1> 775X 33----- 23252325-----25575代码#include<stdio.h>#include<string.h> #define maxn 99int main(){ char a[maxn],s[20]; int x,y,.

2020-07-30 16:18:43 172

原创 蛇形填数——二维数组赋值

输入n输出n*n矩阵,从右上角走蛇形排满1-n*n例子:输入4输出10 11 12 19 16 13 28 15 14 37 6 5 4源代码(C实现)#include<stdio.h>#include<string.h> #define maxn 9int main(){ int a[maxn][maxn]={0}; int r,c,n=0; scanf("%d",&n); r=0;c=n-1; //起始点在a[.

2020-07-30 13:57:04 215

原创 开灯问题——数组

题目:有n盏灯,编号为1-n。第1个人把所有灯打开,第2个人按下所有编号为2的倍数的开关(这些灯将被关掉),第3个人按下所有编号为3的倍数的开关(其中关掉的灯将被打开,开着的灯将被关闭),依此类推。一共有k个人,问最后有哪些灯开着?输入n和k,输出开着的灯的编号。k<=n<=1000.#include<stdio.h>#include<string.h> #define maxn 1001int main(){ int a[maxn]={0}; int

2020-07-30 11:42:53 326

原创 算法竞赛中的输入输出框架

题目:数据统计P27输入一些整数,求出它们的最小值、最大值和平均值(保留3位学习小数)。输入保证这些数都是不超过1000的整数。控制台输入输出#include<stdio.h>#define INF 10000000int main(){ int x,n=0,min=INF,max=-INF,s=0; while(scanf("%d",&x)!=EOF){ if(x<min) min=x; else if(x>max) max=x; n++

2020-07-30 11:00:02 277

原创 PAT (Advanced Level)1002 A+B for Polynomials (25分)

This time, you are supposed to findA+BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial:KN​1​​a​N​1​​​​N​2​​a​N​2​​​​...

2020-07-29 21:50:05 113

原创 PAT (Advanced Level)1001 A+B Format (20分)

Calculatea+band output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input file contains one test case. Each case contains a pair o..

2020-07-29 21:16:39 108

原创 排列(permutation)——算法竞赛入门经典

题目:用1,2,3,...,9组成3个三位数abc,def和ghi,每个数字恰好使用一次,要求abc:def:ghi=1:2:3。按照“abc def ghi”的格式输出所有解,每行一个解。解法一 查找1-9是否都存在于s字符数组中#include<stdio.h>#include<string.h>int main(){ for(int i=123;i<=329;i++){ int temp=i*1000000+i*2*1000+i*3; char

2020-07-29 20:20:28 354 2

原创 生产实习——基于vue框架的web前端开发

1 AirC首页1.1 需求分析1.2 原型设计1.3 结果展示1.4优化思路1.5源代码<template> <div id="Index"> <!-- 占位 --> <div> <!-- 搜索相关开始 --> <el-select v-model="value" placeholder="请选择设备...

2020-07-28 12:24:11 2157

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除