鱼C论坛

 找回密码
 立即注册
查看: 1978|回复: 1

题目207:整数划分方程

[复制链接]
发表于 2016-11-22 19:12:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
Integer partition equations

For some positive integers k, there exists an integer partition of the form   4t = 2t + k,
where 4t, 2t, and k are all positive integers and t is a real number.

The first two such partitions are 41 = 21 + 2 and 41.5849625... = 21.5849625... + 6.

Partitions where t is also an integer are called perfect.
For any m ≥ 1 let P(m) be the proportion of such partitions that are perfect with k ≤ m.
Thus P(6) = 1/2.

In the following table are listed some values of P(m)

   P(5) = 1/1
   P(10) = 1/2
   P(15) = 2/3
   P(20) = 1/2
   P(25) = 1/2
   P(30) = 2/5
   ...
   P(180) = 1/4
   P(185) = 3/13

Find the smallest m for which P(m) < 1/12345.


题目:

对一些正整数 k 来说,存在一个整数划分,它具有 4t = 2t + k 的形式,其中,4t, 2t,k 都是正整数而 t 则是实数。

前两个这样的划分分别是 41 = 21 + 2 和 41.5849625... = 21.5849625... + 6。

如果这个划分中的 t 值 也是整数的话,称之为完美划分。

对于任意大于等于 1 的 m,定义 P(m) 为 k ≤ m 得到的分割中,完美分割所占比例,

因此,P(6) = 1/2。

下表是一些列举的 P(m) 的值:

        P(5) = 1/1
        P(10) = 1/2
        P(15) = 2/3
        P(20) = 1/2
        P(25) = 1/2
        P(30) = 2/5
        ...
        P(180) = 1/4
        P(185) = 3/13

请给出满足 P(m) < 1/12345 的最小的 m 值。


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2018-8-4 13:08:05 | 显示全部楼层
  1. #include<stdio.h>
  2. #define NUM 12345

  3. int main()
  4. {
  5.         long start ;
  6.         long count=0;
  7.         for(start=2;;start++){
  8.                 long tmp=start;
  9.                 while(!(tmp&1)&&tmp!=1){
  10.                         tmp>>=1;
  11.                 }
  12.                 count+=tmp==1?1:0;
  13.                 if(count*NUM<start-1)
  14.                         break;
  15.                
  16.         }
  17.         start<<=1;
  18.         start--;
  19.         start*=start;
  20.         start--;
  21.         start>>=2;
  22.         printf("%ld",start);
  23. }
复制代码

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-1 17:04

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表