当前位置:网站首页>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
边栏推荐
猜你喜欢

C language greedy snake

Smart data won two annual awards at the second isig China Industrial Intelligence Conference

Redis缓存

保证数据库和缓存的一致性

2020-12-04

Digital data was invited to participate in Nantong enterprise digital transformation Seminar

【Kubernetes 系列】Kubernetes 概述

2021-03-06

考过HCIP依然转行失败,职业网工最看重的到底是什么

Leakcanary source code (2)
随机推荐
Spark RDD Programming Guide(2.4.3)
同步电路与跨时钟域电路设计2——多bit信号的跨时钟域传输(FIFO)
c# sqlsugar,hisql,freesql orm框架全方位性能测试对比 sqlserver 性能测试
【ARM】讯为rk3568开发板lvds屏设置横屏显示
Future alternatives to IPv4! Read the advantages, features and address types of IPv6
mysql主从同步及其分库分表基本流程
Unity:利用 射线Ray 检测物体
使用HBuilder X编辑器安装终端窗口插件未响应的解决方案
Unity: use ray to detect objects
考过HCIP依然转行失败,职业网工最看重的到底是什么
Install the typescript environment and enable vscode to automatically monitor the compiled TS file as a JS file
Synchronization circuit and cross clock domain circuit design 2 -- cross clock domain transmission (FIFO) of multi bit signals
Which securities company is the safest and best choice for stock trading account opening
Use full function simulation design method
Smart data won two annual awards at the second isig China Industrial Intelligence Conference
Summary of transport layer knowledge points
WebRTC系列-网络传输之4Connection排序
js读取剪切板的图片
Learning the interpretable representation of quantum entanglement, the depth generation model can be directly applied to other physical systems
eslint 简单配置