当前位置:网站首页>1837. Sum of digits under k-ary representation
1837. Sum of digits under k-ary representation
2022-07-26 10:59:00 【Lovey_ Beihe】
Give you an integer n(10 Base number ) And a cardinality k , Would you please n from 10 The hexadecimal representation is converted to k Hexadecimal said , Calculate and return the... Of each number after conversion The sum of the .
After the transformation , Your numbers should be taken as 10 Hexadecimal Numbers , And the sum of them should be 10 Hexadecimal means to return .
public static int SumBase(int n, int k)
{
int count = 0;
int res;
while (n / k != 0)
{
res = n % k;
count += res;
n /= k;
}
res = n % k;
count += res;
return count;
}
边栏推荐
- Sword finger offer (53): a string representing a numeric value
- @The difference and use of jsonformat and @datetimeformat
- Sword finger offer (44): flip the word order sequence
- 解决org.apache.commons.codec.binary.Base64爆红问题
- c 语言中宏参数的字符串化跟宏参数的连接
- Logging advanced use
- Pre post pytest method
- List ascending and descending
- 菜鸟看源码之ArrayDeque
- 雨课堂 《知识产权法》笔记
猜你喜欢

pytest pytest.ini配置 用例分组 用例跳过

mother

很多人都不清楚自己找的是Kanban软件还是看板软件

RT thread learning notes (VII) -- open the elmfat file system based on SPI flash (middle)

Pre post pytest method

Bash shell学习笔记(二)

35. Search the insertion position

pytest conftest.py和fixture的配合使用

20210807 1 c language program structure

ThreadPoolExecutor是怎样执行任务的
随机推荐
菜鸟看源码之ArrayList
232.用栈实现队列
Software Testing Overview: the background, essence and process of software testing
经典蓝牙的连接过程
Summary of the seventh class of pengge C language
WIRESHARK基础教程以太帧的分析。
pytest conftest.py和fixture的配合使用
Linkedblockingqueue of novice source code
The combination of pytest confitest.py and fixture
@The real difference and usage between validated and @valid
ISO 639:1988 : Code for the representation of names of languages
HCI 接口
@JsonFormat和@DateTimeFormat的区别和使用
What are the biz layer and manager layer in the company project
Visual conversion of nmap vulnerability scanning results
BLE之ATT请求
Many people don't know whether they are looking for Kanban software or Kanban software
pytest fixture装饰器
公司项目中的biz层和manager层是干啥的
Sword finger offer (44): flip the word order sequence