首页
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
Search
1
职教云小助手重构更新,职教云助手最新版下载地址【已和谐】
14,231 阅读
2
职教云-智慧职教,网课观看分析(秒刷网课)
11,464 阅读
3
gradle-5.4.1-all.zip下载
9,507 阅读
4
职教云-智慧职教,签到补签分析(逆天改命系列)
8,201 阅读
5
一个优秀的程序员从写文档开始:免费领14个月语雀云笔记会员
7,017 阅读
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
登录
/
注册
Search
Lan
累计撰写
617
篇文章
累计收到
629
条评论
首页
栏目
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
页面
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
搜索到
617
篇与
的结果
2020-04-01
试题 算法提高 奥运会开幕式
资源限制时间限制:1.0s 内存限制:256.0MB问题描述 学校给高一(三)班分配了一个名额,去参加奥运会的开幕式。每个人都争着要去,可是名额只有一个,怎么办?班长想出了一个办法,让班上的所有同学(共有n个同学)围成一圈,按照顺时针方向进行编号。然后随便选定一个数m,并且从1号同学开始按照顺时针方向依次报数,1, 2, …, m,凡报到m的同学,都要主动退出圈子。然后不停地按顺时针方向逐一让报出m者出圈,最后剩下的那个人就是去参加开幕式的人。 要求:用环形链表的方法来求解。所谓环形链表,即对于链表尾结点,其next指针又指向了链表的首结点。基本思路是先创建一个环形链表,模拟众同学围成一圈的情形。然后进入循环淘汰环节,模拟从1到m报数,每次让一位同学(结点)退出圈子。 输入格式:输入只有一行,包括两个整数n和m,其中n和 m的含义如上所述。 输出格式:输出只有一个整数,即参加开幕式的那个人的编号。输入输出样例样例输入8 3样例输出7import java.util.*; public class 奥运会开幕式 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc =new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt()-1; boolean[] list = new boolean[n]; int count = n; int gun = 0; if (m==0) { System.out.println(n); }else { while(count!=1){ for (int i = 0; i < list.length; i++) { if (!list[i]) { if (gun==m) { list[i]=true; gun =0; count--; }else { gun++; } } } } for (int i = 0; i < list.length; i++) { if (!list[i]) { System.out.println(i+1); } } } } }
2020年04月01日
866 阅读
0 评论
0 点赞
2020-04-01
试题 算法提高 学生成绩统计
资源限制时间限制:1.0s 内存限制:256.0MB问题描述 编写一个程序,建立了一条单向链表,每个结点包含姓名、学号、英语成绩、数学成绩和C++成绩,并通过链表操作平均最高的学生和平均分最低的学生并且输出。输入格式 输入n+1行,第一行输入一个正整数n,表示学生数量;接下来的n行每行输入5个数据,分别表示姓名、学号、英语成绩、数学成绩和C++成绩。注意成绩有可能会有小数。输出格式 输出两行,第一行输出平均成绩最高的学生姓名。第二行输出平均成绩最低的学生姓名。样例输入2yx1 1 45 67 87yx2 2 88 90 99样例输出yx2yx1import java.util.*; public class 学生成绩统计 { /** * @param args */ public static class student{ public String name; public double grade; } public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); student[] stu = new student[n]; student max = new student(); student min = new student(); min.grade=100; for (int i = 0; i < stu.length; i++) { stu[i] = new student(); stu[i].name = sc.next(); double id = sc.nextDouble(); double eng = sc.nextDouble(); double math = sc.nextDouble(); double c = sc.nextDouble(); stu[i].grade = (eng+math+c)/3; if (stu[i].grade>max.grade) { max = stu[i]; } if (stu[i].grade<min.grade) { min = stu[i]; } } System.out.println(max.name); System.out.println(min.name); } }
2020年04月01日
823 阅读
0 评论
0 点赞
2020-03-31
试题 算法提高 质因数
资源限制时间限制:1.0s 内存限制:512.0MB 将一个正整数N(1<N<32768)分解质因数。例如,输入90,打印出90=2*3*3*5。样例输入66样例输出66=2*3*11import java.util.*; public class 质因数 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int i = 2; StringBuffer x= new StringBuffer(); x.append(n+"="); while (n > 1) { if (n%i==0) { n/=i; x.append(i+"*"); }else { i++; } } x.deleteCharAt(x.length()-1); System.out.println(x); } }
2020年03月31日
841 阅读
0 评论
0 点赞
2020-03-31
试题 算法提高 质因数2
资源限制时间限制:1.0s 内存限制:256.0MB 将一个正整数N(1<N<32768)分解质因数,把质因数按从小到大的顺序输出。最后输出质因数的个数。输入格式 一行,一个正整数输出格式 两行,第一行为用空格分开的质因数 第二行为质因数的个数样例输入66样例输出2 3 113样例输入90样例输出2 3 3 54样例输入37样例输出371import java.util.*; public class 质因数2 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int i = 2; int sum = 0; while (n > 1) { if (n % i == 0) { n /= i; sum++; System.out.print(i + " "); } else { i++; } } System.out.println(" " + sum); } }
2020年03月31日
815 阅读
0 评论
0 点赞
2020-03-31
试题 算法提高 身份证号码升级
资源限制时间限制:1.0s 内存限制:256.0MB问题描述 从1999年10月1日开始,公民身份证号码由15位数字增至18位。(18位身份证号码简介)。升级方法为: 1、把15位身份证号码中的年份由2位(7,8位)改为四位。 2、最后添加一位验证码。验证码的计算方案: 将前 17 位分别乘以对应系数 (7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2) 并相加,然后除以 11 取余数,0-10 分别对应 1 0 x 9 8 7 6 5 4 3 2。 请编写一个程序,用户输入15位身份证号码,程序生成18位身份证号码。假设所有要升级的身份证的四位年份都是19××年输入格式 一个15位的数字串,作为身份证号码输出格式 一个18位的字符串,作为升级后的身份证号码样例输入110105491231002样例输出11010519491231002x数据规模和约定 不用判断输入的15位字符串是否合理import java.util.*; public class 身份证号码升级 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String str = sc.next(); str = str.substring(0, 6) + "19" + str.substring(6, 15); char[] yzm = { '1', '0', 'x', '9', '8', '7', '6', '5', '4', '3', '2' }; int[] xs = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }; List<Character> list = new ArrayList<Character>(); int sum = 0; for (int i = 0; i < str.length(); i++) { char x = str.charAt(i); sum += (int) (str.charAt(i) - 48) * xs[i]; list.add(x); } sum %= 11; list.add(yzm[sum]); for (Character character : list) { System.out.print(character); } } }
2020年03月31日
1,209 阅读
0 评论
0 点赞
2020-03-31
试题 算法提高 成绩排序2
资源限制时间限制:1.0s 内存限制:256.0MB问题描述 给出n个学生的成绩,将这些学生按成绩排序,排序规则:总分高的在前;总分相同,数学成绩高的在前;总分与数学相同,英语高的在前;总分数学英语都相同,学号小的在前输入格式 第一行一个正整数n,表示学生人数 接下来n行每行3个0~100的整数,第i行表示学号为i的学生的数学、英语、语文成绩输出格式 输出n行,每行表示一个学生的数学成绩、英语成绩、语文成绩、学号 按排序后的顺序输出样例输入21 2 32 3 4样例输出2 3 4 21 2 3 1数据规模和约定 n≤100import java.util.Scanner; public class 成绩排序2 { public static class student { public int math; public int engilsh; public int chinese; public int id; public int all; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); student[] student = new student[n]; for (int i = 0; i < n; i++) { student[i] = new student(); student[i].math = sc.nextInt(); student[i].engilsh = sc.nextInt(); student[i].chinese = sc.nextInt(); student[i].id = i + 1; student[i].all = student[i].math+student[i].engilsh+student[i].chinese; } for (int i = 0; i < n; i++) { for (int j = 0; j < n-i-1; j++) { if (student[j].all<student[j+1].all) { student temp = student[j]; student[j] = student[j+1]; student[j+1] = temp; }else if (student[j].all==student[j+1].all) { if (student[j].math<student[j+1].math) { student temp = student[j]; student[j] = student[j+1]; student[j+1] = temp; }else if (student[j].math == student[j+1].math) { if (student[j].engilsh<student[j+1].engilsh) { student temp = student[j]; student[j] = student[j+1]; student[j+1] = temp; }else if (student[j].engilsh==student[j+1].engilsh) { if (student[j].id>student[j+1].id) { student temp = student[j]; student[j] = student[j+1]; student[j+1] = temp; } } } } } } for (int i = 0; i < student.length; i++) { System.out.println(student[i].math + " " + student[i].engilsh + " " + student[i].chinese + " " + student[i].id); } } }
2020年03月31日
1,004 阅读
0 评论
0 点赞
2020-03-29
如果使用ssms连接SQLserver的时候出现无法连接到服务器。
标题: 连接到服务器------------------------------无法连接到 xxxxx。------------------------------其他信息:在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接) (Microsoft SQL Server,错误: 2)有关帮助信息,请单击: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476------------------------------因为你没开启首先,Win + R打开输入services.msc回车找到右键启动即可
2020年03月29日
4,417 阅读
0 评论
0 点赞
1
...
76
77
78
...
89