
计蒜客吴永辉数据结构编程实验
ccccccccccs
这个作者很懒,什么都没留下…
展开
-
2.2 筛选法模拟
Self NumbersDescriptionIn 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the dig原创 2018-03-05 22:51:29 · 288 阅读 · 0 评论 -
2.1 简单模拟的编程实验
Speed LimitBill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunately, Bill has a working stopwatch, so they can原创 2018-03-05 22:39:44 · 379 阅读 · 0 评论 -
1.5/1.6 使用二分法提高计算时效
POJ 1003HangoverDescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the car原创 2018-03-05 22:29:52 · 166 阅读 · 0 评论 -
4.7/4.8 多项式的表示与处理(数组应用的典型范例2)
多项式存储的两种方式:1、数值数组 数组的下标与多项式的项的指数相关,数组长度取决于多项式的最高次幂。2、结构数组 数组下标为项序号而非指数值,a[i].coef 当前项的系数 以及a[i].exp 当前项的指数。数组长度是多项式的实际长度。ZOJ 1720Polynomial ShowdownGiven the coefficients of a polynomial from degree 8...原创 2018-03-12 23:16:33 · 697 阅读 · 0 评论 -
4.6 高精度
ZOJ 2001Adding Reversed NumbersThe Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies. Therefore the dramatic advisor of ACM has deci...原创 2018-03-12 12:48:06 · 167 阅读 · 0 评论 -
4.3/4.4/4.5/4.6 高精度(数组应用的典型范例1)
高精度数主要指超出标准数据类型所能表示的数,比如两个200位数相加减。而处理高精度数可以使用数组存储,然后再进行计算。一、高精度数的存储将数字反向存储在数组中,即数字的个位数存储在数组下标为0处,依次类推。for(i=0;i<s.length;i++){num[i]=s[s.length-n-i]-'0';}c语言:char s1[50]; c1=s1;scanf("%s",c1); ...原创 2018-03-11 23:16:30 · 197 阅读 · 0 评论 -
4.1/4.2 应用直接存取类线性表编程
ZOJ 2420CalendarA calendar is a system for measuring time, from hours and minutes, to months and days, and finally toyears and centuries. The terms of hour, day, month, year and century are all units ...原创 2018-03-10 13:44:07 · 282 阅读 · 0 评论 -
八皇后问题总结
3种方法解决:1、经典递归回溯#include <stdio.h>#include <math.h>int num=0;int x[8];int main(){ queen(0); printf("%d",num); return 0;}void queen(int row){if(row>=8){ num++; return ;}int...原创 2018-03-10 09:25:52 · 807 阅读 · 0 评论 -
3.4/3.5 The Sultan's Successors
HDOJ 1642Problem Description The Sultan of Nubia has no children, so she has decided that the country will be split into up to k separate parts on her death and each part will be inherited by whoever ...原创 2018-03-09 21:08:10 · 389 阅读 · 0 评论 -
1.4 提高实数精度
ZOJ 1049I Think I Need a HouseboatFred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana...原创 2018-02-20 23:20:55 · 250 阅读 · 0 评论 -
1.3 SUM OF Consecutive Prime Numbers
离线计算 将连续素数存到数组中POJ 2739SUM OF Consecutive Prime NumbersDescriptionSome positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a give...原创 2018-02-20 23:15:20 · 219 阅读 · 0 评论 -
1.2 正确处理多个测试用例
ZOJ 1760DoublesAs part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each ...原创 2018-02-20 23:12:54 · 683 阅读 · 0 评论 -
1.1 改进程序书写风格
ZOJ 1048Financial ManagementLarry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his...原创 2018-02-20 23:07:21 · 297 阅读 · 0 评论 -
昨日知识总结--next nextLine nextInt
next--读取本行数据,到空格或者换行符之前结束,游标还在本行。nextline--读取本行剩余数据,到换行符结束,游标到下一行。nextInt--读取整型数据,游标在本行。例如:6 9....#......#..............................#@...#.#..#.存到两个变量以及一个char[][]数组中,java:int w = cin.next...原创 2018-03-07 11:26:09 · 319 阅读 · 0 评论 -
昨日知识总结--static关键字
1、static关键字昨日使用到static是java中要在main方法中调用递归方法,main为静态方法,所以调用的递归方法也要设置为静态方法。静态方法: 使方法不再依赖与对象,而是依赖于类本身,方便在没有创建对象的时候访问。this.function(),function()为静态方法的话,则上述表述错误,因为静态方法不依赖于对象,而是依赖于类本身,不依赖于对象,因此不存在this。静态方法只...原创 2018-03-07 08:41:56 · 263 阅读 · 0 评论 -
3.3 回溯法
poj 1979Red and BlackDescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move原创 2018-03-06 23:15:47 · 189 阅读 · 0 评论 -
3.1/3.2 递归与回溯法的编程实验
ZOJ 2172Symmetric OrderIn your job at Albatross Circus Management (yes, it's run by a bunch of clowns), you have just finished writing a program whose output is a list of names in nondescendin原创 2018-03-06 23:10:42 · 347 阅读 · 0 评论 -
2.3 构造法模拟
import java.util.Scanner;//uva 11000public class BEE { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int year = cin.nextInt(); whil原创 2018-03-06 23:06:08 · 201 阅读 · 0 评论 -
4.9 矩阵(数组应用的典型范例3)
zoj 1949Error CorrectionA boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4 x 4 matrix which has the ...原创 2018-03-13 23:03:51 · 292 阅读 · 0 评论