虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

6.<b>12</b>

  • We have a group of N items (represented by integers from 1 to N), and we know that there is some tot

    We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.

    标签: represented integers group items

    上传时间: 2016-01-17

    上传用户:jeffery

  • 汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation

    汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation eg. if n = 2 A→B A→C B→C if n = 3 A→C A→B C→B A→C B→A B→C A→C

    标签: the animation Simulate movement

    上传时间: 2017-02-11

    上传用户:waizhang

  • 本代码为编码开关代码

    本代码为编码开关代码,编码开关也就是数字音响中的 360度旋转的数字音量以及显示器上用的(单键飞梭开 关)等类似鼠标滚轮的手动计数输入设备。 我使用的编码开关为5个引脚的,其中2个引脚为按下 转轮开关(也就相当于鼠标中键)。另外3个引脚用来 检测旋转方向以及旋转步数的检测端。引脚分别为a,b,c b接地a,c分别接到P2.0和P2.1口并分别接两个10K上拉 电阻,并且a,c需要分别对地接一个104的电容,否则 因为编码开关的触点抖动会引起轻微误动作。本程序不 使用定时器,不占用中断,不使用延时代码,并对每个 细分步数进行判断,避免一切误动作,性能超级稳定。 我使用的编码器是APLS的EC11B可以参照附件的时序图 编码器控制流水灯最能说明问题,下面是以一段流水 灯来演示。

    标签: 代码 编码开关

    上传时间: 2017-07-03

    上传用户:gaojiao1999

  • 谭浩强C语言word版 1 C语言概述 2 1.1 C语言的发展过程 2 1.2 当代最优秀的程序设计语言 2 1.3 C语言版本 2 1.4 C语言的特点 3 1.5 面向对象的程序设计

    谭浩强C语言word版 1 C语言概述 2 1.1 C语言的发展过程 2 1.2 当代最优秀的程序设计语言 2 1.3 C语言版本 2 1.4 C语言的特点 3 1.5 面向对象的程序设计语言 3 1.6 C和C++ 3 1.7 简单的C程序介绍 4 1.8 输入和输出函数 5 1.9 C源程序的结构特点 6 1.10 书写程序时应遵循的规则 6 1.11 C语言的字符集 6 1.12 C语言词汇 7 1.13 Turbo C 2.0集成开发环境的使用 8 1.13.1 Turbo C 2.0简介和启动 8 1.13.2 Turbo C 2.0集成开发环境 8 1.13.3 File菜单 9 1.13.4 Edit菜单 10 1.13.5 Run菜单 11 1.13.6 Compile菜单 12 1.13.7 Project菜单 13 1.13.8 Options菜单 14 1.13.9 Debug菜单 18 1.13.10 Break/watch菜单 19 1.13.11 Turbo C 2.0的配置文件 20

    标签: word 语言 1.1 1.2

    上传时间: 2014-01-20

    上传用户:奇奇奔奔

  • 离散实验 一个包的传递 用warshall

     实验源代码 //Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("请输入矩阵第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可传递闭包关系矩阵是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元关系的可传递闭包\n"); void warshall(int,int); int k , n; printf("请输入矩阵的行数 i: "); scanf("%d",&k); 四川大学实验报告 printf("请输入矩阵的列数 j: "); scanf("%d",&n); warshall(k,n); } 

    标签: warshall 离散 实验

    上传时间: 2016-06-27

    上传用户:梁雪文以

  • 道理特分解法

    #include "iostream" using namespace std; class Matrix { private: double** A; //矩阵A double *b; //向量b public: int size; Matrix(int ); ~Matrix(); friend double* Dooli(Matrix& ); void Input(); void Disp(); }; Matrix::Matrix(int x) { size=x; //为向量b分配空间并初始化为0 b=new double [x]; for(int j=0;j<x;j++) b[j]=0; //为向量A分配空间并初始化为0 A=new double* [x]; for(int i=0;i<x;i++) A[i]=new double [x]; for(int m=0;m<x;m++) for(int n=0;n<x;n++) A[m][n]=0; } Matrix::~Matrix() { cout<<"正在析构中~~~~"<<endl; delete b; for(int i=0;i<size;i++) delete A[i]; delete A; } void Matrix::Disp() { for(int i=0;i<size;i++) { for(int j=0;j<size;j++) cout<<A[i][j]<<" "; cout<<endl; } } void Matrix::Input() { cout<<"请输入A:"<<endl; for(int i=0;i<size;i++) for(int j=0;j<size;j++){ cout<<"第"<<i+1<<"行"<<"第"<<j+1<<"列:"<<endl; cin>>A[i][j]; } cout<<"请输入b:"<<endl; for(int j=0;j<size;j++){ cout<<"第"<<j+1<<"个:"<<endl; cin>>b[j]; } } double* Dooli(Matrix& A) { double *Xn=new double [A.size]; Matrix L(A.size),U(A.size); //分别求得U,L的第一行与第一列 for(int i=0;i<A.size;i++) U.A[0][i]=A.A[0][i]; for(int j=1;j<A.size;j++) L.A[j][0]=A.A[j][0]/U.A[0][0]; //分别求得U,L的第r行,第r列 double temp1=0,temp2=0; for(int r=1;r<A.size;r++){ //U for(int i=r;i<A.size;i++){ for(int k=0;k<r-1;k++) temp1=temp1+L.A[r][k]*U.A[k][i]; U.A[r][i]=A.A[r][i]-temp1; } //L for(int i=r+1;i<A.size;i++){ for(int k=0;k<r-1;k++) temp2=temp2+L.A[i][k]*U.A[k][r]; L.A[i][r]=(A.A[i][r]-temp2)/U.A[r][r]; } } cout<<"计算U得:"<<endl; U.Disp(); cout<<"计算L的:"<<endl; L.Disp(); double *Y=new double [A.size]; Y[0]=A.b[0]; for(int i=1;i<A.size;i++ ){ double temp3=0; for(int k=0;k<i-1;k++) temp3=temp3+L.A[i][k]*Y[k]; Y[i]=A.b[i]-temp3; } Xn[A.size-1]=Y[A.size-1]/U.A[A.size-1][A.size-1]; for(int i=A.size-1;i>=0;i--){ double temp4=0; for(int k=i+1;k<A.size;k++) temp4=temp4+U.A[i][k]*Xn[k]; Xn[i]=(Y[i]-temp4)/U.A[i][i]; } return Xn; } int main() { Matrix B(4); B.Input(); double *X; X=Dooli(B); cout<<"~~~~解得:"<<endl; for(int i=0;i<B.size;i++) cout<<"X["<<i<<"]:"<<X[i]<<" "; cout<<endl<<"呵呵呵呵呵"; return 0; } 

    标签: 道理特分解法

    上传时间: 2018-05-20

    上传用户:Aa123456789

  • 简易数字频率计题解.( 1997年 B 题 ) 编写与讲解人:田良(东南大学无线电系,2003年3月12日) 一)任务 设计并制作一台数字显示的简易频率计。 (二)要求 1.基本要求

    简易数字频率计题解.( 1997年 B 题 ) 编写与讲解人:田良(东南大学无线电系,2003年3月12日) 一)任务 设计并制作一台数字显示的简易频率计。 (二)要求 1.基本要求 (1)频率测量 a.测量范围 信号:方波、正弦波 幅度:0.5V~5V[注] 频率:1Hz~1MHz b.测试误差≤0.1% (2)周期测量 a.测量范围 信号:方波、正弦波 幅度:0.5V~5V[注] 频率:1Hz~1MHz b.测试误差≤0.1% 3) 脉冲宽度测量 a.测量范围 信号:脉冲波 幅度:0.5V~5V[注] 脉冲宽度≥100μs b.测试误差≤0.1% (4)显示器 十进制数字显示,显示刷新时间1~10秒 连续可调,对上述三种测量功能分别采用不同颜色的 发光二极管指示。 (5)具有自校功能,时标信号频率为1MHz。 (6)自行设计并制作满足本设计任务要求的稳压电源

    标签: 1997 2003 数字频率计 东南大学

    上传时间: 2013-12-26

    上传用户:xg262122

  • 注塑机生产过程的微机控制系统设计本系统设计是通过8255A并行端口A、B传输数据控制12个LED发光二级管的亮灭来模拟控制两台注塑机的生产过程。其中端口A和B分别对应1号和2号注塑机

    注塑机生产过程的微机控制系统设计本系统设计是通过8255A并行端口A、B传输数据控制12个LED发光二级管的亮灭来模拟控制两台注塑机的生产过程。其中端口A和B分别对应1号和2号注塑机,每一个LED代表一个工序。编程语言采用BORLAND C++语言。

    标签: 8255A 注塑机 LED 生产过程

    上传时间: 2013-12-25

    上传用户:叶山豪

  • java ejb开发 程序4、语句alter table people add(phone_number varchar2(10)) 的作用是 A 修改表结构 B 为people表添加约束

    java ejb开发 程序4、语句alter table people add(phone_number varchar2(10)) 的作用是 A 修改表结构 B 为people表添加约束,约束名称是phone_number C 向people表中添加一列,名称是phone_number,数据类型是varchar2,长度是10 D 上述答案均不正确 5、( )BLOB和CLOB的区别在于 A CLOB只能存放字符类型的数据,而BLOB没有任何限制 B BLOB只能存放字符类型的数据,而CLOB没有任何限制 C CLOB只能存放小于4000字节的数据,而BLOB可以存放大于4000字节的数据 D BLOB只能存放小于4000字节的数据,而CLOB可以存放大于4000字节的数据 6、存储过程从本质上来讲就是 A 匿名的PL/SQL程序块,它可以被赋予参数 B 命名的PL/SQL程序块,它可以被赋予参数 C 命名的PL/SQL程序块,不能被赋予参数 D 匿名的PL/SQL程序块,不能被赋予参数 7、( )下列关于日期数据类型,哪一个语句是正确的写法 A insert into test values( 9999-12-03 ) B insert into test values( 1999-03-02 ) C insert into test values(to_char(1999-06-03, yyyy/dd/mm )) D insert into test

    标签: people phone_number varchar2 alter

    上传时间: 2013-12-26

    上传用户:wendy15

  • Delphi2005 B/S程序设计技巧集(12-14) 现在delphi 2005 B/S的书籍资料太少

    Delphi2005 B/S程序设计技巧集(12-14) 现在delphi 2005 B/S的书籍资料太少,几乎没有可参考的资料,这在一定程度上限制了delphi 2005的使用,相反C#,ASP的书籍资料到处都是。通过几个月的学习也算是总结了一点经验,从现在起我将陆续将ASP和C#的例子、技巧翻译到delphi 2005下面,希望对大家的学习和工作有帮助,毕竟.Net是一种发展趋势。我将不定期写新的内容,同时,如果你在工作或学习中有什么问题,我也会将问题加入本篇文章,另外,一个人的能力毕竟有限,也希望大家共同来解决问题。 宋雨炫

    标签: 2005 Delphi delphi 12

    上传时间: 2013-12-30

    上传用户:jennyzai