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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education