We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #99: Largest exponential

Project Euler #99: Largest exponential

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 99 from projecteuler.net

Comparing two numbers written in index form like and is not difficult, as any calculator would confirm that .

However, confirming that would be much more difficult, as both numbers contain over three million digits.

You are given base exponent pairs, each forming a large number you have to find the smallest number of them. is .

Input Format

First line containts an integer , number of base exponent pairs. Followed by lines each have two space separated integers and , representing base and exponent.
Last line containts an integer , where

Constraints





No two numbers are equal.

Output Format

Print the base and exponent in one line separated by space.

Sample Input

3
4 7
3 7
2 11
2

Sample Output

3 7

Author

shashank21j

Difficulty

Medium

Max Score

100

Submitted By

2639

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy