当前位置:网站首页>OJ daily exercise - virus proliferation
OJ daily exercise - virus proliferation
2022-06-22 23:33:00 【KJ. JK】
Problem description :
A certain virus grows into its original form every hour KK times . If at first the virus had SS individual , that HH Hours later, , How many viruses are there ? If the number of viruses reaches or exceeds 20212021 individual , Then the number of output viruses is right 20212021 The mold .
Input
3 It's a positive number K、S、H
Output
1 It's a positive number , Represents the number of viruses . If the number of viruses reaches or exceeds 20212021 individual , Then the number of output viruses is right 20212021 The mold
Examples
Input
2 1 3
Output
8
Java Code :
import java.util.*; // Viral proliferation
public class Main {
public static void main(String[] args) {
Scanner rd=new Scanner(System.in);
long k=rd.nextLong();
long s=rd.nextLong();
long h=rd.nextLong();
while(h>0) {
if((h&1)==1) {
s=s*k%20212021;
}
k=k*k%20212021;
h>>=1;
}
System.out.println(s);
}
}
author :KJ.JK
If the article is helpful to you , Welcome to praise or star, Your support is the greatest encouragement to the author , The shortcomings can be corrected in the comments section , Communication and learning
边栏推荐
- flink同步mysql数据到ES
- 2021-04-16
- 【STM32技巧】使用STM32 HAL库的硬件I2C驱动RX8025T实时时钟芯片
- LeakCanary 源码详解(2)
- 2020-12-20
- Use smart doc to automatically generate interface documents
- 在Word中自定义多级列表样式
- 2020-12-20
- 剑指 Offer 06. 从尾到头打印链表
- Do domestic mobile phones turn apples? It turned out that it was realized by 100 yuan machine and sharp price reduction
猜你喜欢

LeakCanary 源码详解(2)

企业数字化不是各自发展,而是全面SaaS化推进

Asynchronous FIFO

2021-04-05

PHP7.3报错undefined function simplexml_load_string()

别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!

The breakthrough of key chips hindering Huawei 5g mobile phones has been achieved, and domestic chips have gained 10% share

C language -- 17 function introduction

Spark RDD Programming Guide(2.4.3)

Tp5.1 upload excel file and read its contents
随机推荐
Is it safe to make an appointment to pay new debts? Is it reliable?
OJ每日一练——单词的长度
OJ每日一练—— 班级就餐
14. 最长公共前缀
为 localStorage 添加过期时间
PHP7.3报错undefined function simplexml_load_string()
2020-12-04
Dip1000,1 of D
Longest word in output string
OJ每日一练——删除单词后缀
[arm] it is reported that horizontal display is set for LVDS screen of rk3568 development board
13. 罗马数字转整数
Considerations for using redisson to operate distributed queues
Common operations of sourcetree version management
os.Args[1:]中命令行参数为空时,不执行内部语句
Relationship between adau1452 development system interface and code data
2021-05-02
China Mobile's mobile phone users grow slowly, but strive for high profit 5g package users
Which securities company is the safest and best choice for stock trading account opening
[kubernetes series] overview of kubernetes