fork(1) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static int Poteguj(int zzz, int ccc)
  6. {
  7. int a;
  8. if (ccc == 0)
  9. {
  10. return 1;
  11. }
  12. if (ccc % 2 != 0)
  13. {
  14. return zzz * Poteguj(zzz, ccc - 1);
  15. }
  16. else
  17. {
  18. a = Poteguj(zzz, ccc / 2);
  19. }
  20. return a * a;
  21.  
  22. }
  23. public static void Main()
  24. {
  25. int ile;
  26. int x, y;
  27. ile = Convert.ToInt32(Console.ReadLine());
  28. for (int i = 1; i <= ile; i++)
  29. {
  30. string[] a = Console.ReadLine().Split(' ');
  31. x = Convert.ToInt32(a[0]);
  32. y = Convert.ToInt32(a[1]);
  33. int wynik = Poteguj(x, y);
  34. wynik = (wynik > 10) ? wynik % 10 : wynik;
  35. Console.WriteLine(wynik);
  36. }
  37. }
  38. }
Success #stdin #stdout 0.01s 131200KB
stdin
10
1000000000 1000000000
999999999 1000000000
999999998 1000000000
999999997 1000000000
999999996 1000000000
999999995 1000000000
999999994 1000000000
999999993 1000000000
999999992 1000000000
999999991 1000000000
stdout
0
-459538431
0
-1024686079
0
7
0
-1647284223
0
-194179071