- 博客(8)
- 收藏
- 关注
原创 1030 Travel Plan --java实现
题目:A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path between his/her starting city and the destination. If
2023-05-04 16:46:04
94
原创 1021 Deepest Root--java实现
题目:A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest root.Each input file contains o
2023-05-02 16:05:52
175
原创 1019 General Palindromic Number-java实现
题目:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers.Although palindromic numbers are most often consider
2023-05-02 14:19:56
102
1
原创 1025 PAT Ranking
题目:Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after the test. Now it is y
2023-04-30 22:53:38
77
原创 1024 Palindromic Number java实现
题意:给一个不超过10位数的数N,经过不大于k次变化(加上反转N),如果经过i次变化成回文数,则输出这个数和i,如果经过k次变化都不能变化成回文数,那么输出第k次变化后的数和k。思路:因为这个数不超过10位数,但是如果这个数为10位数,经过99次变化,那么可能超过long和int的范围,那么必须使用BigInteger类,1.反转可以 先将大整数转为StringBuffer再使用reverse()方法再转换为大整数类。2.判断回文可以 将大整数类转为String类 定义两个指针一个在前一个在后比较。
2023-04-29 22:19:49
117
1
原创 1023 Have Fun with Numbers java实现
题目:Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a di
2023-04-29 21:38:10
136
3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅