- 博客(18)
- 收藏
- 关注
原创 PTA第9章文件作业9-4 程序查重 (10分)
9-4 程序查重 (10分)文件查重:现有两个数据文件,分别为source.txt和dest.txt,编程统计source.txt中有多少行跟dest.txt中同等位置的行内容重复,输出重复率。如: source.txt内容: 第一行为aaa;第二行为bbb;第三行为ccc; 而dest.txt内容: 第一行为aaa;第二行为ddd;第三行为ccc,第四行为bbb 查重系统会发现source.txt的第一行和第三行与dest.txt的第一行和第三行相同,而dest共有四行,所以source.txt的内容
2020-05-23 10:35:26 3912 1
原创 PTA第9章文件作业9-5 谁是冠军 (10分)
9-5 谁是冠军 (10分)文件查重:若干名选手参加扣篮大赛,共有5个评委,现有一个二进制文件pf.dat,内容为选手参加扣篮大赛决赛的成绩(总分高者获胜),编程找出谁是champion(输出冠军者姓名)。输出格式:如果冠军是zhangwei,则输出zhangwei is champion!struct person { char name[20]; int score[5]; };编写的源程序命名为test.cpp,提交之前,将pf.dat和test.cpp放...
2020-05-23 09:35:43 1614 2
原创 The Cow Lexicon(DP)
Few know that the cows have their own dictionary with W (1 ≤ W ≤ 600) words, each containing no more 25 of the characters ‘a’…‘z’. Their cowmunication system, based on mooing, is not very accurate; sometimes they hear words that do not make any sense. For
2020-05-20 22:51:32 199
原创 Find The Multiple
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decima
2020-05-19 21:42:19 131
原创 PTA 第9章文件作业 9-3 统计图书 (10分)
有一个存放图书信息的二进制数据文件book.dat(书名,购买年份,价格),统计低于平均书价的图书记录并保存到二进制文件cheapbk.dat。struct books { char sm[30]; int gmrq; int price; };编写的源程序命名为test.cpp,提交之前,将系统提供的book.dat和test.cpp放在src文件夹下,然后在src文件夹的上层文件夹中压缩src.zip,保证这个zip文件中有src文件夹和其中的test.cpp文件。注意:以下example程序为方
2020-05-15 16:40:40 1356
原创 PTA 第9章文件实验 9-2 统计素数 (10分)
实验9 文件 一、实验目的(1)掌握文件以及缓冲文件系统、文件指针的概念。(2)学会使用文件打开、关闭、读写等文件操作函数。(3)掌握对文件进行字符写、块读写的方法。(4)巩固文件教学单元的知识。二、实验内容1、一批整数保存在文本文件in.txt中,统计出的所有素数,保存在out.txt文件中。重要提示:自己编写的程序命名为test.cpp,本地测试test.cpp时,访问in.txt和out.txt不用带路径,当打包提交时test.cpp中in.txt和out.txt的路径修改为./src/
2020-05-14 21:18:49 4747 5
原创 PTA 第9章文件实验 9-1 求平均值 (10分)
实验9 文件 一、实验目的(1)掌握文件以及缓冲文件系统、文件指针的概念。(2)学会使用文件打开、关闭、读写等文件操作函数。(3)掌握对文件进行字符写、块读写的方法。(4)巩固文件教学单元的知识。二、实验内容1、一批学生数据(包括学号、姓名、3门课成绩)存储在stud.dat文件中,编程实现计算出总的平均成绩并保存在average.dat文件中。提示:平均成绩保留2位小数。struct student{ char num[10]; char name[20]; int score[3];
2020-05-13 19:56:35 4101 4
原创 PTA 第9章文件作业9-1 统计得分率 (10分)
有一个二进制数据文件zy.dat,内容为一批学生期末考试4道题的得分情况(姓名,成绩1,成绩2,成绩3,成绩4),统计本次考试中每道题(1~4)的得分率并保存到二进制文件result.dat(数据之间用空格隔开)。如:0.783 0.795 0.845 0.914重要提示:自己编写的程序命名为test.cpp,本地测试test.cpp时,访问zy.dat和result.dat不用带路径,当打包提交时将zy.dat和result.dat的路径修改为./src/提交之前,将系统提供的原始zy.dat和te
2020-05-13 17:27:17 3473 2
原创 K-th Not Divisible by n
You are given two positive integers n and k. Print the k-th positive integer that is not divisible by n.For example, if n=3,and k=7, then all numbers that are not divisible by 3 are: 1,2,4,5,7,8,10,11,13…The 7-th number among them is 10.The first line co
2020-05-10 21:54:58 307
原创 记忆化搜索
FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. At each grid location Fatmouse has hid between 0 and 100 blocks of chee
2020-05-10 09:36:10 116
原创 搜索
Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个ABC的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Ignatius能否在魔王回来前离开城堡(只要走到出口就算离开城堡,如果走到出口的时候魔王刚好回来也算逃亡成功),如果可
2020-05-09 21:11:09 4515
原创 拓扑
John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed.InputThe input will consist of several instances of the problem. Each instance begins with a lin
2020-05-09 20:20:12 112
原创 约数
A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, … shows the first 20 humble numbers.Now given a humble number, please write a program to calcul
2020-05-08 20:41:12 131 1
原创 AYIT-2020 大一五一比赛(一) Tautology
A tautology is a WFF that has value 1 (true) regardless of the values of its variables. For example, ApNp is a tautology because it is true regardless of the value of p. On the other hand, ApNq is n...
2020-05-03 21:04:57 159
原创 AYIT-2020 大一五一比赛(一) Fibonacci again and again
任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是菲波那契数列。在HDOJ上有不少相关的题目,比如1005 Fibonacci again就是曾经的浙江省赛题。今天,又一个关于Fibonacci的题目出现了,它是一个小...
2020-05-03 20:12:47 204
原创 AYIT-2020 大一五一比赛(一) 过山车
RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿意和水域浪子或伪酷儿做partner。考虑...
2020-05-03 19:59:14 153
原创 AYIT-2020 609五一训练题 展开字符串
在纺织CAD系统开发过程中,经常会遇到纱线排列的问题。该问题的描述是这样的:常用纱线的品种一般不会超过25种,所以分别可以用小写字母表示不同的纱线,例如:abc表示三根纱线的排列;重复可以用数字和括号表示,例如:2(abc)表示abcabc;1(a)=1a表示a;2ab表示aab;如果括号前面没有表示重复的数字出现,则就可认为是1被省略了,如:cd(abc)=cd1(abc)=cdabc;这种表...
2020-05-03 09:17:59 190
原创 Tree Recovery
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.This is an example of one of her creatio...
2020-05-01 20:45:53 93
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人