1. 

/**
* Angewandte Mathematik, SS11
* Problem: 748 Exponentiation
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&page=show_problem&problem=689
* @author Brielbeck, Daniel
* @author Weber, Georg
* @version 1.0, 04/12/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.136
*/
import java.util.*;
import java.math.*;

class Main {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
while (reader.hasNext()) {
BigDecimal bd = new BigDecimal(reader.next());
int x = Integer.parseInt(reader.next());
bd = bd.pow(x);
String ans = new String(bd.toPlainString());
int end_zero = ans.length();
for (int i = ans.length() - 1; i >= 0; --i) {
if (ans.charAt(i) == '0') end_zero = i;
else break;
}
ans = ans.substring(0, end_zero);
if (bd.compareTo(BigDecimal.ONE) < 0) ans = ans.substring(1);
System.out.println(ans);
}
}
}

2.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.StringTokenizer;

/**
* Angewandte Mathematik, SS11
* Problem: 748 - Exponentiation
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=9&page=show_problem&problem=689
*
* @author Unverzart Michael
* @author Wurth Manuel
* @version 1.0, 11/4/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.104
*/

public class Main {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String inputLine;
while((inputLine = reader.readLine())!=null)
{
StringTokenizer st = new StringTokenizer(inputLine);
BigDecimal r = new BigDecimal(st.nextToken());
int n = new Integer(st.nextToken());
String output = r.pow(n).toPlainString();
while (output.startsWith("0")) output=output.substring(1, output.length());
while (output.endsWith("0")) output=output.substring(0, output.length()-1);
System.out.println(output);
}
}
}