topcoder SRM500 div1 Level3

该博客主要介绍了TopCoder SRM500比赛中一个关于整数约束的问题。博主通过设立变量di表示每个数字i的出现次数,并通过公式计算总和s和特定位数之和p2、p3。提出通过枚举d6、d8、d9、d4的值来简化计算,从而解决该问题,总计需要枚举8000000次。提供了问题解析和代码实现链接。
摘要由CSDN通过智能技术生成

Problem Statement

  NOTE: This problem statement contains superscripts that may not display properly if viewed outside of the applet.

A positive integer is called nice if the sum of its digits is equal to S and the product of its digits is equal to 2p2 * 3p3 * 5p5 * 7p7. Return the sum of all nice integers, modulo 500,500,573.

Definition

 
Class: ProductAndSum
Method: getSum
Parameters: int, int, int, int, int
Returns: int
Method signature: int getSum(int p2, int p3, int p5, int p7, int S)
(be sure your method is public)
 
 

Constraints

- p2, p3, p5 and p7 will each be between 0 and 100, inclusive.
- S will be between 1 and 2,500, inclusive.

Examples

0)  
 
2
0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值