当前位置:编程学习 > C/C++ >>

C解两道题

1.If p is the perimeter of a right angle 易做图 with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. click

{20,48,52}, {24,45,51}, {30,40,50}

For which value of p <=1000, is the number of solutions maximised?

翻译过来就是:

如果p是这样一个数,满足三元组{a,b,c}之和是p,且a,b,c能组成直角三角形的三个边。当p=120的时候,且有三个解:

{20,48,52}, {24,45,51}, {30,40,50}

那么在p<=1000以内,满足以上条件的解的个数最多的p是几?

答案:840.

{ code placeholder}

2.A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:

012 021 102 120 201 210

What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? click

翻译:A permutation is an ordered arrangement of objects。(大意就是排列的定义)比如,3124是数字1,2,3,4的一种可能排列。如果把所有的排列按照数字或者字母列出来,我们称为字典顺序。数字0,1,2的字典排序为:

012 021 102 120 201 210

那么数字0,1,2,3,4,5,6,7,8,9的字典排序的第1000000(100万)个排列数字是几?

  答案:2783915460{ code placeholder}

 

补充:软件开发 , C语言 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,