POWAH! UNLIMITED POWAH! Problem Emperor Palpatine has the vicious ability to shoot force lightning out of his fingers. The way this works is actually quite predictable through some mathematical computation. Depending on how much Palpatine has exerted himself that day, he has a certain amount of energy E stored. Once he starts shooting lightning, the power P of his lightning is equal to 1. After each millisecond, Pincreases by a factor of E that is to say, we multiply P by E to get the new P. Given Palpatine's initial energy E and the number of milliseconds he has been shooting lightning out of his fingers, compute the power P of his lightning. Since this may be very large, output P modulo 107. 24 Input Format Input consists of a single test case containing a line with two integers E and T separated by a space indicating the energy and the time elapsed in milliseconds. Constraints 1≤E≤ 10¹2 0≤T≤ 10¹2 Output Format Output consists of one line containing Palpatine's power P after T milliseconds modulo 107. Sample Input 0 Sample Output 0 16 Sample Input 1 Submissions 10 4 Discussions Sample Output 1 10000

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question

PUP Problem Set

Can be answered in Java 8, C++14, or Pypy 3

POWAH! UNLIMITED POWAH!
Problem
Emperor Palpatine has the vicious ability to shoot force lightning out of his fingers. The way this works is
actually quite predictable through some mathematical computation. Depending on how much Palpatine has
exerted himself that day, he has a certain amount of energy E stored. Once he starts shooting lightning, the
power P of his lightning is equal to 1. After each millisecond, P increases by a factor of E that is to say, we
multiply P by E to get the new P.
Given Palpatine's initial energy E and the number of milliseconds he has been shooting lightning out of his
fingers, compute the power P of his lightning. Since this may be very large, output P modulo 107.
24
Input Format
Input consists of a single test case containing a line with two integers E and T separated by a space indicating
the energy and the time elapsed in milliseconds.
Constraints
1≤E≤ 10¹2
0≤T≤ 10¹2
Output Format
Output consists of one line containing Palpatine's power P after T milliseconds modulo 107.
Sample Input 0
Sample Output 0
16
Sample Input 1
Submissions
10 4
Discussions
Sample Output 1
10000
Transcribed Image Text:POWAH! UNLIMITED POWAH! Problem Emperor Palpatine has the vicious ability to shoot force lightning out of his fingers. The way this works is actually quite predictable through some mathematical computation. Depending on how much Palpatine has exerted himself that day, he has a certain amount of energy E stored. Once he starts shooting lightning, the power P of his lightning is equal to 1. After each millisecond, P increases by a factor of E that is to say, we multiply P by E to get the new P. Given Palpatine's initial energy E and the number of milliseconds he has been shooting lightning out of his fingers, compute the power P of his lightning. Since this may be very large, output P modulo 107. 24 Input Format Input consists of a single test case containing a line with two integers E and T separated by a space indicating the energy and the time elapsed in milliseconds. Constraints 1≤E≤ 10¹2 0≤T≤ 10¹2 Output Format Output consists of one line containing Palpatine's power P after T milliseconds modulo 107. Sample Input 0 Sample Output 0 16 Sample Input 1 Submissions 10 4 Discussions Sample Output 1 10000
1 import java.io. Buffered Reader;
2 import java.io.InputStreamReader;
3
Nm tibro ao-NM +
4 public class Solution {
5-
6
7
8.
9-
10
11
12
13
14
15
16
17 }
public static void main(String[] args) throws Exception {
Buffered Reader br = new Buffered Reader (new InputStreamReader (System.in));
String[] parts = br.readLine().trim().split(" ");
}
long e = Long.parse Long (parts[0]);
long t = Long.parseLong (parts [1]);
// compute for answer
public static long solve (long e, long t) {
}
Transcribed Image Text:1 import java.io. Buffered Reader; 2 import java.io.InputStreamReader; 3 Nm tibro ao-NM + 4 public class Solution { 5- 6 7 8. 9- 10 11 12 13 14 15 16 17 } public static void main(String[] args) throws Exception { Buffered Reader br = new Buffered Reader (new InputStreamReader (System.in)); String[] parts = br.readLine().trim().split(" "); } long e = Long.parse Long (parts[0]); long t = Long.parseLong (parts [1]); // compute for answer public static long solve (long e, long t) { }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole