Created
June 6, 2018 01:48
-
-
Save whatalnk/62233a0c13c04360670fdae1f93bc108 to your computer and use it in GitHub Desktop.
AtCoder ABC #097 B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = gets.chomp.to_i | |
y = Math.sqrt(x).to_i + 1 | |
if x == 1 then | |
puts 1 | |
exit | |
end | |
ans = 1 | |
2.upto(y) do |i| | |
a = i | |
10.times do |j| | |
a *= i | |
if a > x then | |
break | |
elsif a > ans then | |
ans = a | |
end | |
end | |
end | |
puts ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment